digiarnie digiarnie - 29 days ago 19
Java Question

dom4j converting text to special characters

I'm using dom4j to parse my xml. Let's say I have something like this:

<?xml version="1.0" encoding="UTF-8"?>
<foo>
<bar>&#402;</bar>
</foo>


When looking at the value of the "bar" node, it gives me back the special character as represented by "& #402;"

Is there a way to prevent this and just read in the actual bit of text?

Answer

The actual bit of text being &#402;? You need to escape ampersand as &amp; then.