How to preserve numeric entities when converting xml String to a org.w3c.dom.Document ?

Artur Tomusiak <[email protected]>
Newsgroups gmane.text.xml.xalan.java.user
Message-ID <[email protected]>
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 numeric XML entities. 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>

After looking more closely, I realized that the org.w3c.dom.Document 
object already contains the converted text, which means the problem lies 
in conversion from the String to Document, and not when converting back 
from Document to String.

Please let me know (an example code would be very appreciated) how can I 
do the described conversions while preserving the numeric entities in 
the XML.

Thanks,
Artur


-- 
Artur Tomusiak
(678) 904-6900 ext 140
Hannon Hill - CMS Experience You Can Trust
http://www.hannonhill.com
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.