[jdom-interest] Outputting escaped entities in element text

Bradley S. Huffman hip at a.cs.okstate.edu
Thu Oct 3 08:43:09 PDT 2002

Elliotte Rusty Harold writes:

> 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.

Hmmm, so char. references are no longer allowed in XML documents?

> It is completely contrary to the JDOM model, and mixes syntax with
> semantics in a very  damaging way.

Yes it's contrary to the model, that's why it should *NOT* be checked into
the CVS. But it is a solution to a specific problem that can be used today.

> Just put the characters you need in your Java strings and let XMLOutputter
> escape them as necessary.

Which the poster seems to have already tried with


and found it does not work with the FOP he is using. If it is a bug in the
FOP the ideal solution would be for it's writers to fix the bug, but then again,
we don't live in an ideal world.


More information about the jdom-interest mailing list