-
-
Notifications
You must be signed in to change notification settings - Fork 83
XMLStreamReader.getAttributeValue(null, localName)
does not ignore namespace URI
#53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
To me that seems working exactly as specified. You are asking for value of attribute with namespace URI of Looking at Stax javadoc, however, handling of namespace URI is defined as... something that makes no sense, claiming no matching is to be done. That is not what Stax specification said as far as I remember -- however, since Oracle does not make their TCK freely available (one has to be JCP member), I can not verify what their compliancy tests claim. |
my use-case is: i want to switch my Stax-Parser from "Xerces-J 2.7.1" which is bundled within the JRE to Woodstox. The Javadoc of the JRE for the function "XMLStreamReader.getAttributeValue(..)" is as follow getAttributeValue(String namespaceURI, String localName) Returns the normalized attribute value of the attribute with the namespace and localName If the namespaceURI is null the namespace is not checked for equality My code that worked with "Xerces-J 2.7.1" now does not work with Woodstox, because Xerces works like the above Javadoc and tolerates NULL as value and will not check the namespaceURI for equality in this case. I could also change my code, but i find it strange that the woodstox-code works differently than the javadoc. |
@flappingeagle while I see what javadoc says, I am not convinced that is how Stax specification dictates it (although... knowing how sparsely it was documented, can't be sure). But from XML perspective that interpretation is pretty senseless as namespace information is intrinsic part of element and attribute names, and ignoring that is just plain Wrong. Be that as it may, this is how Woodstox is designed to work, based on my understanding of Stax specification. It is not a bug I would fix for a patch version, although if specification really does dictate "just ignore namespace", I would consider it a bug to fix for next minor version. Finally, reference to Xerces seems bit irrelevant as Xerces implements SAX and DOM interfaces, not Stax (unless I am mistaken? I don't think older version like 2.7.1 does, at least). |
Ok thanks. In regards to Xerces: XMLInputFactory.newInstance() xmlInputFactory.createXMLStreamReader(input) as you see, xerces is contained within the "rt.jar" of the Oracle JRE. On the console the xerces-version of the JRE can be resolved like this (returns Xerces-J 2.7.1 in my case): java com.sun.org.apache.xerces.internal.impl.Version And because XMLStreamReader is provided by xerces, i followed that Xerces does implement the Stax-API. Just for info. |
@flappingeagle Ok thank you for including that information: I was not aware of Xerces-backed implementation (nor seen announcements). But class names do seem to suggest such existing. But back to the original question... since Javadoc does indeed state that I will try to see how easy it would be to fix. Thank you for reporting this. |
XMLStreamReader.getAttributeValue(null, localName)
does not ignore namespace URI
Fixed. Attribute value lookup for |
Uh oh!
There was an error while loading. Please reload this page.
i use woodstox-5.1.0 and jackson-2.7.7
Following quick xml-example shows that the function getAttributeValue(..) does not work as expected for resolving an attribute of an xml-element by its localName.
The xml used here is an example from: https://www.w3schools.com/xml/schema_schema.asp
The text was updated successfully, but these errors were encountered: