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));
System.out.println(doc.getRootElement().getAdditionalNamespaces());
displays:
[[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()) {
element.addNamespaceDeclaration(ns);
}
?
--
_______________________________________________
Download the free Opera browser at http://www.opera.com/
Free OperaMail at http://www.operamail.com/
Powered by Outblaze