[jdom-interest] SAXBuilder adds a newline!?

MarkW markw at wilsoncom.de
Wed Jul 18 00:49:20 PDT 2001

> If i read the formatted (with LF+CR) template files using SAXBuilder and
> then try to parse them using DOM (not jdom!) i get errors because the
> number

> How can you read it in using SAXBuilder and then "parse" using DOM? That
> doesn't make sense. The result of SAXBuilder is a JDOM Document, parsed.
> Maybe you can explain a little more thoroughly what you are doing?

> of child-nodes DOM thinks it has are more than in reality due to newlines
> added by SAXBuilder (XMLOutputter is not involved; i used XMLOutputter to
> look at what was being read).

i store the xml-data using an internal class (not really more than a
string-buffer with several properties). I can then retrieve the xml-data
either as a DOM-object or as a JDOM-object.
As i said i´m gradually changing from DOM to JDOM so the code is a mixture
of both.
In one of my classes i read xml-data using DOM to build a JTree-menu and
that´s were i get problems with the xml-data read from a formatted template
using SAXBuilder. It works fine when i remove the LF+CR but then it´s not
exactly easy reading and manipulating the templates!
I hope the problem is a clearer now.


More information about the jdom-interest mailing list