[jdom-interest] additionalNamespaces

rpcee rpcee at operamail.com
Tue Jul 9 08:09:07 PDT 2002

the javadoc for Element.getAdditionalNamespaces() says it excludes the element namespace, but in the case of a document built via SAXBuilder, it returns all namespace declarations for that element, eg:

final String xml = "<n:root xmlns:n='uri1' xmlns:z='uri2'/>";
doc = new SAXBuilder().build(new StringReader(xml));


[[Namespace: prefix "n" is mapped to URI "uri1"], [Namespace: prefix "z" is mapped to URI "uri2"]]

I think it's a consequence of the commented out code in SAXHandler::startElement(), and the fix is that SAXHandler::transferNamespaces() needs something like:

if (ns != element.getNamespace()) {


Download the free Opera browser at http://www.opera.com/

Free OperaMail at http://www.operamail.com/

Powered by Outblaze

More information about the jdom-interest mailing list