2

I've been using the xom.nu library to save and parse XML files for an application. Unfortunately, I just realized that it's been XML-encoding my special characters, but it hasn't been decoding them when I call toString().

Example:

Element element = new Element("Test");
element.appendChild("This & That"); //Will create XML as follows: <Test>This &amp; That</Test>
//Saved to a file

Reading it later

//File opened, elements retrieved from file, rootElement is the root element
Element test = rootElement.getFirstChildElement("Test");
System.out.println(test.getValue()); //Prints This &amp; That

How can I retrieve the text so that it cleans the output before returning it? I don't want to have to import another library if I don't have to, and if it can encode then it should be able to decode the string.

ahjohnston25
  • 1,915
  • 15
  • 36

0 Answers0