[jdom-interest] Preventing Escape Character Conversion

Ian Bryson ibryson at hotmail.com
Thu Mar 27 04:19:35 PST 2003


Hi,

I need to prevent escape characters being converted when I read in an XML 
string.  I have & in my XML and I don't want them being converted to &.

I am doing something like the following:

    SAXBuilder builder = new SAXBuilder();
    StringReader s = new StringReader("<hello><world>Hello &amp; 
World</world></hello>");
    Document doc = builder.build(s);

    Element e = doc.getRootElement();
    Element wrld = e.getChild("world");
    System.out.println(wrld.getText);

This converts &amp; to &.

Any help in preventing this conversion would be appreciated.

Cheers,

Ian



_________________________________________________________________
Worried what your kids see online? Protect them better with MSN 8 
http://join.msn.com/?page=features/parental&pgmarket=en-gb&XAPID=186&DI=1059




More information about the jdom-interest mailing list