[jdom-interest] Attribute and Namespace
Tom M. Yeh
tomyeh at infoshock.com.tw
Thu Oct 4 00:15:04 PDT 2001
In my test case, JDOM uses SAXBuilder and then SAXHandler, while DOM uses the Xerces DOM builder. So, the result might be different.
I apologize that I didn't try the latest code, before asking questions. After browsing the source codes, I found the problem "shall" be fixed because Brett has commented out statements at line 496-498. However, this fix looks odd to me, because it introduces a side effect: adding an extra namespace to Element.additionalNamespace. Won't it be better by replacing line 528 as follows?
attribute = factory.attribute(attLocalName, atts.getValue(i),
From: Jason Hunter [mailto:jhunter at collab.net]
Sent: Thursday, October 04, 2001 2:50 PM
To: Tom M. Yeh
Cc: jdom-interest at jdom.org
Subject: Re: [jdom-interest] Attribute and Namespace
JDOM uses Xerces (or some other parser) so your statement is a little
odd. It might be that JDOM differs from the DOM built by Xerces.
Before we get into that, have you tried this with the latest code in
"Tom M. Yeh" wrote:
> 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!
> To control your jdom-interest membership:
More information about the jdom-interest