[jdom-interest] SAXBuilder adds a newline!?

MarkW markw at wilsoncom.de
Fri Jul 13 08:10:42 PDT 2001

JDOM beta 7 and CVS from yesterday.
Using SAXBuilder etc. to merge several xml-files.
The template files are have no indents, no newlines after each section and
were created using an ascii editor.
I create the Document objects using:

  public static org.jdom.Document fileToJDOMDoc( String filename )
    org.jdom.Document doc = null;
      org.jdom.input.SAXBuilder builder = new org.jdom.input.SAXBuilder();
      doc = builder.build(filename);
    catch ( org.jdom.JDOMException jdx )
      logError( jdx );

    return doc;

When i merge the files (using elementFromMainDoc.addContent(
(Element)subDoc.getRootElement().clone() );) and will read the xml i get
errors from the parser. Looking at the resulting merged file it has newlines
after each closed tag: (header-section, action-tag and name-tag added per
JDOM later)

<?xml version="1.0" encoding="UTF-8"?>









Got the same result using DOMBuilder.

Is this a bug or am i wasting your time?

Mark Wilson

More information about the jdom-interest mailing list