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 Artur Tomusiak <ar...@hannonhill.com> on 2009/04/14 18:57:40 UTC

How to preserve numerical character references when converting xml String to a org.w3c.dom.Document ?

Hello,

I am trying to convert a String with XML content in it into the 
org.w3c.dom.Document object to do some modifications and then to convert 
it back to the String. However, even if I do not do any modifications to 
the object, I am still getting back a different String than what I have 
provided as an input. The problem is with the numerical character 
references. For example, if my input String is:

<?xml version="1.0" encoding="UTF-8"?>
<xml>
   &#169;
   &#38;  
</xml>

Once I convert this to an org.w3c.dom.Document object and then back to 
String, I am getting this as a result:

<?xml version="1.0" encoding="UTF-8"?>
<xml>
   ©
   &amp;  
</xml>

Please let me know (an example code would be very appreciated) if it is 
possible at all to preserve the  numerical character references so they 
aren't converted to the actual characters.

Thanks,
Artur

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