Akacem Mohammed wrote:

I have the probleme that the SaxParser when parsing a string is presumely replacing \r\n throught \n.
Has someone an idea how I could avoid this? I actually need the carriage return (\r) because the string will be displayed later on on a client (win) . ( now I am simply adding the carriage return, but I think there should be a better solution).

hi,

you can encode carriage return as a character entity in XML and it will be preserved by XML parser (simply put 
 int your XML). beware however that if you use SAX there can be multiple characters() callbacks for characters before carriage return, just with carriage return and after it. also this will not work for attribute value (attribute values have different normalization rules)

this is a popular topic use google and find more resources, for example see
http://lists.xml.org/archives/xml-dev/200301/msg00136.html
http://lists.xml.org/archives/xml-dev/200210/msg00891.html
http://lists.xml.org/archives/xml-dev/200201/msg00842.html
http://lists.xml.org/archives/xml-dev/200201/msg01106.html

here are more general resources: one about XML and character encoding in much more detail:
http://skew.org/xml/tutorial/
and this is a nice page on special characters and how they are handled in XSLT (similar issues apply to XML processing with SAX):
http://xml.web.cern.ch/XML/www.dpawson.co.uk/xsl/sect2/N7150.html

hope it helps,

alek

--
"Mr. Pauli, we in the audience are all agreed that your theory is crazy. What divides us is whether it is crazy enough to be true." Niels H. D. Bohr




Reply via email to