Hello All,
I am trying to use some “special characters” for the value of an attribute. See the code below:
Document document = new DocumentHelper().parseText("<Data><ResultRow value=\"\"/></Data>"); Attribute att = (Attribute)document.selectSingleNode("/Data/ResultRow/@value"); att.setValue(">"); System.out.println(att.getValue()); java.io.FileWriter out = new java.io.FileWriter("c:\\test.xml"); document.write(out); out.flush(); out.close(); out = null;
The system.out.println line display the proper character “>”. However when I attempt to print this data out to a file, something is encoding the “&” and replaces it with “&” - I need the value element to remain “>” not “&#62;”. This is an example of the out file:
<?xml version="1.0" encoding="UTF-8"?> <Data><ResultRow value="&#62;"/></Data>
Any help would be most appreciated. Many thanks in advance.
Frank Sharpless Manager, Application Development Paperhost.com, Inc. 770.998.9172.611
|
- Re: [dom4j-user] Special Encoding Issue Frank Sharpless
- Re: [dom4j-user] Special Encoding Issue David D. Lucas