[jdom-interest] XML escaping and unescaping

tballen at COPART.COM tballen at COPART.COM
Fri Nov 19 14:07:29 PST 2004


You could always enclose the data with a CDATA tag within the element.
The parser should extract the data accordingly.

Thanks,
Todd


At 01:34 PM 11/19/2004 -0800, 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?
>
>i.e.
>
>String -> XML Safe string -> String
>
>"This" -> "This"  -> "This"  (no change needed)
>"4+3<4+4" -> "4+3&lt;4+4" -> "4+3<4+4"
>
>I only ask because I have some basic routines that do this, but they only 
>map the following:
>
> >   &gt;
><   &lt;
>&   &amp;
>'     &apos;
>"    &quot;
>
>It currently doesn't deal with escaped character codes like &#039;
>
>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.
>
>Thanks,
>David





More information about the jdom-interest mailing list