[jdom-interest] XML escaping and unescaping
jhunter at xquery.com
Fri Nov 19 14:31:51 PST 2004
XMLOutputter has escapeElementEntities() and escapeAttributeEntities()
that do what you want and have a pluggaable EscapeStrategy to handle
characters outside the selected output encoding. We don't have code to
do the reverse as we rely on XML parsers for that.
d.wall at computer.org wrote:
> Does JDOM come with any utility routines that will take a String and
> make it XML safe? And also a routine that takes an XML safe encoding
> and converts it back to a regular String?
> String -> XML Safe string -> String
> "This" -> "This" -> "This" (no change needed)
> "4+3<4+4" -> "4+3<4+4" -> "4+3<4+4"
> I only ask because I have some basic routines that do this, but they
> only map the following:
> > >
> < <
> & &
> ' '
> " "
> It currently doesn't deal with escaped character codes like '
> It seems that putting data into XML and getting it back from XML is so
> common that there must be a general routine to do this rather than
> having to rely on my own implementation.
> To control your jdom-interest membership:
More information about the jdom-interest