You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cxf.apache.org by Aaron Ehrensberger <ae...@docfinity.com> on 2010/11/10 21:07:59 UTC

Preserve leading whitespace in XML

Hi,

Does CXF have an issue with preserving leading whitespace inside XML
responses?  Is there something special I need to be doing?

Basically, I'm searching a file for a specific word and want to return the
line of the file that contains the word EXACTLY AS IS.  However, the leading
whitespaces are being trimmed during the conversion process to stream back
the XML.

For example...search a document for the word Running....my file contains

$Id: RUNNING.txt 354430 2005-12-06 13:44:26Z yoavs $
            ===================================================
            Running The Apache Tomcat 6.0 Servlet/JSP Container
            ===================================================
Apache Tomcat 6.0 requires the Java 2 Standard Edition Runtime
Environment (JRE) version 5.0 or later.

In the java code during debug, I find that
"            Running The Apache Tomcat 6.0 Servlet/JSP Container"
is found as my string.  It preserves the leading whitespace through the
DTO's and webservices until I "return" from the webservice.  But, the XML
response contains
<searchHitRange>
               <context>Running The Apache Tomcat 6.0 Servlet/JSP
Container</context>
</searchHitRange>

...with the whitespace gone.  Is there a way to preserve it?  I'm currently
running CXF 2.2.3.

I'd appreciate any help,

Aaron

Re: Preserve leading whitespace in XML

Posted by Aaron Ehrensberger <ae...@docfinity.com>.
Thanks for the feedback.  I'll work on integrating your suggestions and see
what I find.

Thanks.

Aaron


On Fri, Nov 12, 2010 at 3:32 PM, Daniel Kulp <dk...@apache.org> wrote:

>
> We have system tests that actually test this, so this kind of surprises me.
> Can you try with a more recent version of CXF.   Also, make sure you have
> the
> woodstox parser available instead of the buggy one in the JDK.
>
> Dan
>
>
> On Wednesday 10 November 2010 3:07:59 pm Aaron Ehrensberger wrote:
> > Hi,
> >
> > Does CXF have an issue with preserving leading whitespace inside XML
> > responses?  Is there something special I need to be doing?
> >
> > Basically, I'm searching a file for a specific word and want to return
> the
> > line of the file that contains the word EXACTLY AS IS.  However, the
> > leading whitespaces are being trimmed during the conversion process to
> > stream back the XML.
> >
> > For example...search a document for the word Running....my file contains
> >
> > $Id: RUNNING.txt 354430 2005-12-06 13:44:26Z yoavs $
> >             ===================================================
> >             Running The Apache Tomcat 6.0 Servlet/JSP Container
> >             ===================================================
> > Apache Tomcat 6.0 requires the Java 2 Standard Edition Runtime
> > Environment (JRE) version 5.0 or later.
> >
> > In the java code during debug, I find that
> > "            Running The Apache Tomcat 6.0 Servlet/JSP Container"
> > is found as my string.  It preserves the leading whitespace through the
> > DTO's and webservices until I "return" from the webservice.  But, the XML
> > response contains
> > <searchHitRange>
> >                <context>Running The Apache Tomcat 6.0 Servlet/JSP
> > Container</context>
> > </searchHitRange>
> >
> > ...with the whitespace gone.  Is there a way to preserve it?  I'm
> currently
> > running CXF 2.2.3.
> >
> > I'd appreciate any help,
> >
> > Aaron
>
> --
> Daniel Kulp
> dkulp@apache.org
> http://dankulp.com/blog
>



-- 
Aaron Ehrensberger
Software Architect
DocFinity® by Optical Image Technology, Inc.
100 Oakwood Avenue, State College, PA  16803
ph: 814.238.0038 ext. 270
fax: 814.238.0011
email: aehrensberger@docfinity.com
web: www.docfinity.com

Re: Preserve leading whitespace in XML

Posted by Daniel Kulp <dk...@apache.org>.
We have system tests that actually test this, so this kind of surprises me.   
Can you try with a more recent version of CXF.   Also, make sure you have the 
woodstox parser available instead of the buggy one in the JDK.

Dan


On Wednesday 10 November 2010 3:07:59 pm Aaron Ehrensberger wrote:
> Hi,
> 
> Does CXF have an issue with preserving leading whitespace inside XML
> responses?  Is there something special I need to be doing?
> 
> Basically, I'm searching a file for a specific word and want to return the
> line of the file that contains the word EXACTLY AS IS.  However, the
> leading whitespaces are being trimmed during the conversion process to
> stream back the XML.
> 
> For example...search a document for the word Running....my file contains
> 
> $Id: RUNNING.txt 354430 2005-12-06 13:44:26Z yoavs $
>             ===================================================
>             Running The Apache Tomcat 6.0 Servlet/JSP Container
>             ===================================================
> Apache Tomcat 6.0 requires the Java 2 Standard Edition Runtime
> Environment (JRE) version 5.0 or later.
> 
> In the java code during debug, I find that
> "            Running The Apache Tomcat 6.0 Servlet/JSP Container"
> is found as my string.  It preserves the leading whitespace through the
> DTO's and webservices until I "return" from the webservice.  But, the XML
> response contains
> <searchHitRange>
>                <context>Running The Apache Tomcat 6.0 Servlet/JSP
> Container</context>
> </searchHitRange>
> 
> ...with the whitespace gone.  Is there a way to preserve it?  I'm currently
> running CXF 2.2.3.
> 
> I'd appreciate any help,
> 
> Aaron

-- 
Daniel Kulp
dkulp@apache.org
http://dankulp.com/blog

Re: Preserve leading whitespace in XML

Posted by Sergey Beryozkin <sb...@gmail.com>.
Can you post an xml fragment example please ? is it JAX-WS that you use ?

cheers, Sergey



On Wed, Nov 10, 2010 at 8:07 PM, Aaron Ehrensberger <
aehrensberger@docfinity.com> wrote:

> Hi,
>
> Does CXF have an issue with preserving leading whitespace inside XML
> responses?  Is there something special I need to be doing?
>
> Basically, I'm searching a file for a specific word and want to return the
> line of the file that contains the word EXACTLY AS IS.  However, the
> leading
> whitespaces are being trimmed during the conversion process to stream back
> the XML.
>
> For example...search a document for the word Running....my file contains
>
> $Id: RUNNING.txt 354430 2005-12-06 13:44:26Z yoavs $
>            ===================================================
>            Running The Apache Tomcat 6.0 Servlet/JSP Container
>            ===================================================
> Apache Tomcat 6.0 requires the Java 2 Standard Edition Runtime
> Environment (JRE) version 5.0 or later.
>
> In the java code during debug, I find that
> "            Running The Apache Tomcat 6.0 Servlet/JSP Container"
> is found as my string.  It preserves the leading whitespace through the
> DTO's and webservices until I "return" from the webservice.  But, the XML
> response contains
> <searchHitRange>
>               <context>Running The Apache Tomcat 6.0 Servlet/JSP
> Container</context>
> </searchHitRange>
>
> ...with the whitespace gone.  Is there a way to preserve it?  I'm currently
> running CXF 2.2.3.
>
> I'd appreciate any help,
>
> Aaron
>

Re: Preserve leading whitespace in XML

Posted by Sergey Beryozkin <sb...@gmail.com>.
Can you post an xml fragment example please ? is it JAX-WS that you use ?

cheers, Sergey



On Wed, Nov 10, 2010 at 8:07 PM, Aaron Ehrensberger <
aehrensberger@docfinity.com> wrote:

> Hi,
>
> Does CXF have an issue with preserving leading whitespace inside XML
> responses?  Is there something special I need to be doing?
>
> Basically, I'm searching a file for a specific word and want to return the
> line of the file that contains the word EXACTLY AS IS.  However, the
> leading
> whitespaces are being trimmed during the conversion process to stream back
> the XML.
>
> For example...search a document for the word Running....my file contains
>
> $Id: RUNNING.txt 354430 2005-12-06 13:44:26Z yoavs $
>            ===================================================
>            Running The Apache Tomcat 6.0 Servlet/JSP Container
>            ===================================================
> Apache Tomcat 6.0 requires the Java 2 Standard Edition Runtime
> Environment (JRE) version 5.0 or later.
>
> In the java code during debug, I find that
> "            Running The Apache Tomcat 6.0 Servlet/JSP Container"
> is found as my string.  It preserves the leading whitespace through the
> DTO's and webservices until I "return" from the webservice.  But, the XML
> response contains
> <searchHitRange>
>               <context>Running The Apache Tomcat 6.0 Servlet/JSP
> Container</context>
> </searchHitRange>
>
> ...with the whitespace gone.  Is there a way to preserve it?  I'm currently
> running CXF 2.2.3.
>
> I'd appreciate any help,
>
> Aaron
>