[jdom-interest] Namespaces and XMLOutputter

Thomas Riessler thomas.riessler at db.com
Wed Jan 17 04:26:52 PST 2001

if I build a JDOM Document object from the following XML source (using SAXBuilder):

<?xml version="1.0" encoding="ISO-8859-1"?>
<a:messagelist xmlns:a="http://www.a.com" xmlns:b="http://www.b.com" xmlns:c="http://www.c.com">
<c:item1 value="500"/>

and printout this unchanged Document with the output method of XMLOutputter, I do not get the same XML source returned. Instead output() writes the following code:

<?xml version="1.0" encoding="ISO-8859-1"?>
<a:messagelist xmlns:a="http://www.a.com">
<b:message1 xmlns:b="http://www.b.com">
<c:item1 xmlns:c="http://www.c.com" value="500"/>
</b:message1 xmlns:b="http://www.b.com">
</a:messagelist xmlns:a="http://www.a.com">

Note that the namespace declarations (including URLs) have moved from the root element to all Elements affected by a namespace prefix.

This occurs with beta 5 and the nightly build I downloaded today.
This is kind of a suprise to me since this problem (among others) was adressed by Kesav Kumar in his post on "Namespace prefix" (Fri, 13 Oct 2000 15:11:46 -0700 ) and has been reported to be fixed.

This presents a big jdom usability problem to our project (we're currently evaluating it) since our XML docs are large and the namespace declarations would have a huge performance impact.
Besides that, the target application we want to communicate with, cannot handle these declarations. Whats the current status of the problem?

Thomas Riessler


Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail ist nicht gestattet.

This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden.

More information about the jdom-interest mailing list