You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by Scott Moore <pu...@cox.net> on 2003/01/24 20:32:44 UTC

CR/LF handling

I have a text string with carriage returns #xA embedded in it.  When I create a Text node in the latest Xerces DOM with this string, all my carriage returns get converted to a space.  I really need to preserve these carriage returns.  How can I do this? 

Thanks,
Scott

Re: CR/LF handling

Posted by Scott Moore <pu...@cox.net>.
Thanks for the reply.  You are absolutely correct.  Thank you.

What exactly does setPreserveSpace(true) do?  Are there other side effects
from this call?

Scott


----- Original Message -----
From: "Thomas Corte" <Th...@knipp.de>
To: <xe...@xml.apache.org>
Sent: Saturday, January 25, 2003 6:22 AM
Subject: Re: CR/LF handling


> Hi,
>
> Scott Moore wrote:
>
> > I have a text string with carriage returns #xA embedded in it.  When I
> > create a Text node in the latest Xerces DOM with this string, all my
> > carriage returns get converted to a space.  I really need to preserve
> > these carriage returns.  How can I do this?
>
> Are you sure that the CR/LF disappear on *parsing*? I'd assume they
> should merely be normalized to a simple LF by the parser (this is what I
> encountered).
>
> However, they may disappear on *serialization*, but this can be
> prevented by invoking
>
>    setPreserveSpace (true)
>
> on the used OutputFormat.
>
> HTH,
>
> --
> Thomas Corte
> Thomas.Corte@knipp.de
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
> For additional commands, e-mail: xerces-j-user-help@xml.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org


Re: CR/LF handling

Posted by Thomas Corte <Th...@knipp.de>.
Hi,

Scott Moore wrote:

> I have a text string with carriage returns #xA embedded in it.  When I 
> create a Text node in the latest Xerces DOM with this string, all my 
> carriage returns get converted to a space.  I really need to preserve 
> these carriage returns.  How can I do this? 

Are you sure that the CR/LF disappear on *parsing*? I'd assume they 
should merely be normalized to a simple LF by the parser (this is what I 
encountered).

However, they may disappear on *serialization*, but this can be 
prevented by invoking

   setPreserveSpace (true)

on the used OutputFormat.

HTH,

-- 
Thomas Corte
Thomas.Corte@knipp.de


---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org