[jdom-interest] namespace nit in B6

Jason Hunter jhunter at acm.org
Mon Jul 2 14:29:34 PDT 2001

"Kyle F. Downey" wrote:
> I'm using the XMLOutputter to re-output a JDOM tree I
> loaded using the SAXBuilder. In between, I add a new
> node whose name is in the default namespace for the
> document. However, the new node gets printed with
> the namespace specified explicitly:
> <registry xmlns="http://schemas.a3sr.com/registry/bs/xml.xsd">
>   <stdbs:key xmlns:stdbs="http://schemas.a3sr.com/registry/bs/xml.xsd"/>
> </registry>
> The parser should handle this fine, of course, but it
> violates the Principle of Least Astonishment and it
> also bulks up the document unnecessarily. Can the outputter
> check whether the element name's Namespace URI matches
> the document namespace URI before deciding to qualify
> the name and add an xmlns tag?

If you're using beta6 you should really jump to beta7.  Lots has

That may not affect this though because if you explicitly made a
Namespace with the prefix "stdbs" for the key element, then the
outputter is doing the right thing in preserving that prefix in the


More information about the jdom-interest mailing list