Xerces converting CRLF to LF in text nodes, how to prevent
Joined: Jun 04, 2001
<tt><BR> I'm working on a XML over http application on websphere/windows 2K. I <BR> believe the libpath has Xerces 1.4.3. I am having a problem <BR> preserving CRLF in text nodes. It looks to me as if they are being replaced with LF only when the xml stream is parsed. I can build a dom using the dom parser from a stream that has a text element containing CRLF, retreive the parent node using getElementsByTagName,concatonate all the textNodes that are children of that node using getNodeValue. The resulting string contains only LF instead of CRLF. Is there a way to prevent this short of wraping the text in CDATA? Thanks in advance for any help. Jeff Gaer
Sun Certified Java Programmer Java 2<P>Jeff Gaer
Joined: Jul 09, 2001
Please read the XML specification at http://www.w3.org/TR/2000/REC-xml-20001006#sec-white-space The following sections seem to be relevant to your case - White Space Handling and End-of-Line Handling. So, it's obvious that Xerces does exactly what it's supposed to do. I wonder whether the attribute xml:space when set to preserve, will keep the CRLF characters. Cheers, Dan
William Butler Yeats: All life is a preparation for something that probably will never happen. Unless you make it happen.