[jdom-interest] Attribute and Namespace

Tom M. Yeh tomyeh at infoshock.com.tw
Tue Oct 2 21:39:28 PDT 2001


I found a behavior of JDOM differs from Xerces. When parsing the following XML (thru SAXBuilder+Xerces).

<ns:ele xmlns:ns="http://anydomain" ns:attr>

Then, the namespace of the 'attr' attribute is NO_NAMESPACE, rather than the ns namespace. On the other hand, it works well if I use JAXP + Xerces.

After looking the source codes, I found SAXHandler seems not adding element's namespace to availableNamespaces. Thus, when SAXHandler.getNamespace got called for the attribute, no namespace is found!

More information about the jdom-interest mailing list