The moose likes XML and Related Technologies and the fly likes unescaping in xml document Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "unescaping in xml document" Watch "unescaping in xml document" New topic

unescaping in xml document

shail nig

Joined: Oct 20, 2003
Posts: 14
m using ContentHandler to generate xml
in data i have <STRONG>
which is being converted to & lt; STRONG & gt;

i want to avoid this

any idea how this can be done


[ April 12, 2006: Message edited by: shail nig ]
[ April 12, 2006: Message edited by: shail nig ]
Scheepers de Bruin
Ranch Hand

Joined: Jul 19, 2005
Posts: 99
See that's because it is DATA. What's to prevent any system from confusing that "<STRONG>", that is data, with an actual xml tag?

The < and > get converted into entities for exactly that reason. If your xml requires the <STRONG> tag, make it part of your xml, and not your data. If not, you have to live with the conversion.

We're doomed!!<br />Yay!!!<br />No that's bad Girr!!<br />Yay!!!
Peer Reynders

Joined: Aug 19, 2005
Posts: 2933
And if somebody suggests that you should use a CDATA section, don't.

In particular, do not use CDATA sections as a sort of pseudo-element to hide HTML in your XML documents...

Processing XML with Java - Elliotte Rusty Harold
The CDATASection Interface
I agree. Here's the link:
subject: unescaping in xml document
It's not a secret anymore!