[jdom-interest] namespace nit in B6

Kyle F. Downey kdowney at amberarcher.com
Mon Jul 2 14:25:18 PDT 2001


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?

--kd




More information about the jdom-interest mailing list