[jdom-interest] Problems with "<" and ">" in
element.addContent()
Elliotte Rusty Harold
elharo at metalab.unc.edu
Wed Jan 2 06:52:11 PST 2002
At 12:18 PM +0100 1/2/02, Ann Bjrklund wrote:
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 Im doing wrong?
You're adding a String. If you want child elements you need to add
child elements; e.g.
element.addContent(new Element("HTML");
--
+-----------------------+------------------------+-------------------+
| Elliotte Rusty Harold | elharo at metalab.unc.edu | Writer/Programmer |
+-----------------------+------------------------+-------------------+
| The XML Bible, 2nd Edition (Hungry Minds, 2001) |
| http://www.ibiblio.org/xml/books/bible2/ |
| http://www.amazon.com/exec/obidos/ISBN=0764547607/cafeaulaitA/ |
+----------------------------------+---------------------------------+
| Read Cafe au Lait for Java News: http://www.cafeaulait.org/ |
| Read Cafe con Leche for XML News: http://www.ibiblio.org/xml/ |
+----------------------------------+---------------------------------+
More information about the jdom-interest
mailing list