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 "Rathi, Pradeep" <pr...@documentum.com> on 2001/03/13 01:38:05 UTC

Parser not preserving carriage return character

Hi,

I've noticed that the carriage return character of Windows i.e. "\r\n" is
not handled correctly by the xerces parser. It is converted to "\n". Has
anyone run into similar problems and if so are there any solutions?

To reproduce:
1. Have a xml file that contains the windows carriage return character in
the content of an element.
2. Have a ContentHandler and in the characters() method, print the
characters to a file.
3. Open the file in vi or notepad and you should see control characters
instead of the line separators.

Thanks,
Pradeep

Re: Parser not preserving carriage return character

Posted by Arnaud Le Hors <le...@us.ibm.com>.
It's not a bug in the parser. It's what the XML spec says the parser
must do. See http://www.w3.org/TR/REC-xml#sec-line-ends
-- 
Arnaud  Le Hors - IBM Cupertino, XML Strategy Group

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


Re: Parser not preserving carriage return character

Posted by Bob Kline <bk...@rksystems.com>.
On Tue, 13 Mar 2001, Rathi, Pradeep wrote:

> Hi,
> 
> I've noticed that the carriage return character of Windows i.e.
> "\r\n" is not handled correctly by the xerces parser. It is
> converted to "\n". Has anyone run into similar problems and if so
> are there any solutions?

Any parsers you have seen which do *not* behave this way fail to conform
to section 2.11 [1] of the XML recommendation.

[1] http://www.w3.org/TR/2000/REC-xml-20001006#sec-line-ends

-- 
Bob Kline
mailto:bkline@rksystems.com
http://www.rksystems.com


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