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("&#62;");

     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 “&#62;”. However when I attempt to print this data out to a file, something is encoding the “&” and replaces it with “&amp;” - I need the value element to remain “&#62;” not “&amp;#62;”. This is an example of the out file:

 

<?xml version="1.0" encoding="UTF-8"?>

<Data><ResultRow value="&amp;#62;"/></Data>

 

Any help would be most appreciated. Many thanks in advance.

 

Frank Sharpless

Manager, Application Development

Paperhost.com, Inc.

770.998.9172.611

 

Reply via email to