[jdom-interest] Special characters in XML?

Jason Hunter jhunter at collab.net
Fri Mar 16 12:57:53 PST 2001


> Not completely. The the XMLOutputter will only escape chars that mess-up the
> XML parsing. It does not encode the chars which are 'invalid' for an XML
> document.

JDOM actually enforces at construction time that no invalid chars are
present in the document.

> For example, if you set an attribute to have text with chars with values <
> x020 then there is no encoding and when you reparse the file, your XML parse
> will puke-up.

It never would get to the outputter.  The Attribute constructor would
have thrown an exception on construction with those illegal chars.  You
may not have witnessed this because all char checks aren't yet
implemented and the Attribute check is relatively new.

-jh-



More information about the jdom-interest mailing list