[jdom-interest] Creating element

Robert (Jamie) Munro rjmunro at arjam.net
Thu Aug 28 09:43:24 PDT 2003


New, Cecil (GEAE) wrote:

> How about putting CDATA markers around it?
>  
> Thus
> 
>         <![CDATA[
>         <p>... all your content here </p>
>         ]]>

That just makes the situation worse. If you want to turn a string of XML 
into JDOM, use SAXBuilder to convert it into elements. If you want to 
put a literal string into the JDOM heircachy, use addContent(String).

Remember when you think about these things that the addContent(String) 
doesn't escape the <>, it's SAXBuilder that unescapes them. In JDOM, 
things are not escaped - it's only when they are turned into XML (with 
XMLOutputter) that the escaping occurs.

Robert Munro




More information about the jdom-interest mailing list