[jdom-interest] Problems with '<' and '>' in element.addContent()
Ken Rune Helland
kenh at csc.no
Wed Jan 2 04:04:04 PST 2002
> I have a problem when I try to add content included the signs "<"
> and ">"to an element. I write:
The characters '<' and '>' are xml characters and jdom asumes when these
characters is in a child content that these characters is to be escaped as
not to be read as xml characters ( '<' is the escape for '<' and '>'
To get what you need i jdom you must make a 'HTML' element and add a 'HEAD'
element and a 'BODY' element as children to the 'HTML' element.
Content inside the body must then be added as children to the 'BODY'
Element root = new Element("HTML");
Document doc = new Document( root );
Element body = new Element("BODY");
Element header1 = new Element("H1");
When outputting this document you shoud get someting like
But im not certain JDOM is good for html as valid html is not nesesarily
More information about the jdom-interest