[jdom-interest] Outputting escaped entities in element text

Elliotte Rusty Harold elharo at metalab.unc.edu
Thu Oct 3 06:17:02 PDT 2002

At 9:23 PM -0500 10/2/02, Bradley S. Huffman wrote:
>Here's a patch to XMLOutputter that does what you want.
>It leaves any substring matching "&#[0-9]+;" or "&#x[0-9a-fA-F]+;" in a
>Attribute value or Text untouched. This may or may not be what most people
>want, but now it's in the archive for those who wish to find and apply it :)

Please don't apply this. This is simply wrong. It is completely 
contrary to the JDOM model, and mixes syntax with semantics in a very 
damaging way. What you need to do is understand that Java and XML 
escape strings very differently. Just put the characters you need in 
your Java strings and let the XMLOutputter escape them as necessary.

| Elliotte Rusty Harold | elharo at metalab.unc.edu | Writer/Programmer |
|          XML in a  Nutshell, 2nd Edition (O'Reilly, 2002)          |
|              http://www.cafeconleche.org/books/xian2/              |
|  http://www.amazon.com/exec/obidos/ISBN%3D0596002920/cafeaulaitA/  |
|  Read Cafe au Lait for Java News:  http://www.cafeaulait.org/      |
|  Read Cafe con Leche for XML News: http://www.cafeconleche.org/    |

More information about the jdom-interest mailing list