[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;
try
{
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"?>
<message>
<header>
<type>clientdatatreeservice</type>
<connectionid>1</connectionid>
</header>
<body>
<action>create</action>
<data>
<name>kunden</name>
<definition>
<name>kunden</name>
<navigationbutton>
<title>Kunden</title>
<icon>kunden</icon>
</navigationbutton>
<nodeupdateaction>
<title>Kundenaktualisieren</title>
<service>serverdatatreeservice</service>
<action>update</action>
</nodeupdateaction>
<itemupdateaction>
<title>Kundeaktualisieren</title>
<service>serverdatatreeservice</service>
<action>updateitem</action>
</itemupdateaction>
<seek>
<items>
<item>
<name>kundennr</name>
<title>Kundennr.</title>
<picture>9999</picture>
</item>
<item>
<name>firma</name>
<title>Firma</title>
<picture>x</picture>
</item>
<item>
<name>plz</name>
<title>PLZ</title>
<picture>x</picture>
</item>
</items>
</seek>
.............
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