[jdom-interest] Problems with "<" and ">" in element.addContent()
Sébastien Pierre
spierre at isb-sib.ch
Wed Jan 2 06:09:34 PST 2002
Le mercredi 2 janvier 2002, à 12:18 PM, Ann Björklund a écrit :
> Hi
>
> I have a problem when I try to add content included the
> signs "<" and ">" to an element.
> I write:
>
> element.addContent("<HTML><HEAD></HEAD><BODY>");
>
> and then use a XMLOutputter to write it out to a file.In my
> file I got the result
>
> <HTML><HEAD></HEAD><BODY>
>
> I want to have "<" instead of "<" and ">" instead of ">".
> Does anyone know what Iím doing wrong?
I think you should then use the CDATA class. Something like:
element.addContent(new CDATA("<HTML><HEAD></HEAD><BODY>"));
The thing is that XML does not allow < outside of a CDATA
element, thought > should be ok anywhere.
Cheers,
-- Sébastien.
--
«Life begins at the centerfold and expands outward.»
<http://www.type-z.org> -- Miss November, 1966
More information about the jdom-interest
mailing list