[jdom-interest] Escaping ampersand left in output from XMLOutputter

Per Norrman per.norrman at austers.se
Sun Jan 23 15:57:20 PST 2005


Hi,

JDOM never interprets character entities. Instead of doing:

   e.setText("&#4e24;");

create the text using Java's unicode support:

   e.setText("\u4e24");

or directly:

   e.setText("两");

Wether this character will be encoded or not depends on the
encoding you use when you output the document.

/pmn

Scott Yeadon skrev:
> Hi,
> 
> When writing out a file using the XMLOutputter, character entities are 
> left escaped. Is this behaviour intentional? I would have thought this 
> would only be required for internal processing and the ampersand entity, 
> when affixed to a character entity, should be de-escaped when output. 
> For example, I currently get 两 in my output instead of 
> 两 which browsers do not understand. Is there a way of turning 
> this behaviour off, or does anyone know the appropriate way to handle 
> this in JDOM (I'd rather not do a post-process!)?
> 
> Thanks.
> 
> Scott.
> _______________________________________________
> To control your jdom-interest membership:
> http://www.jdom.org/mailman/options/jdom-interest/youraddr@yourhost.com
> 



More information about the jdom-interest mailing list