[jdom-interest] problem with & conversion string_to_jdom

Per Norrman pernorrman at telia.com
Thu Apr 15 04:00:10 PDT 2004


frederic Mottais wrote:
> Hello
>  
> When I want to convert a string (which is like an xml document) in a 
> document JDOM, I have a problem when there is a &.
> Must I need to convert & by & in the string or SAXbuilder can do it? 
> How can i do ?
>  
> the exemple
> 
>             String toto = "<root><footer>TO&TO</footer></root>";
> 
>             SAXBuilder builder = *new* SAXBuilder();
> 

You must either escape the & character or put the text in a CDATA
section. As you say, your string is 'like an xml document', but it isn't
well formed XML.

/pmn



More information about the jdom-interest mailing list