fix(xmlelement): resolve namespaced XML attributes by prefix#898
Open
Noethix55555 wants to merge 1 commit into
Open
fix(xmlelement): resolve namespaced XML attributes by prefix#898Noethix55555 wants to merge 1 commit into
Noethix55555 wants to merge 1 commit into
Conversation
XMLElement.Attr, ChildAttr and ChildAttrs matched xmlquery attributes only on Name.Local, ignoring the namespace. When an element carried a namespaced and an unprefixed attribute sharing a local name (for example ns:id and id), the namespaced one could be returned for a bare local lookup, and a prefixed attribute could not be requested at all. Match the full prefix:local name first and fall back to the bare local name, preserving existing behaviour for unprefixed attributes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #897.
XMLElement.Attr,ChildAttrandChildAttrsmatchedxmlqueryattributes only onName.Local, ignoring the namespace. With both a namespaced and an unprefixed attribute sharing a local name (for examplens:idandid), a bare lookup could return the namespaced value, and a prefixed attribute could not be requested at all.This matches the full
prefix:localname first and falls back to the bare local name, so existing lookups of unprefixed attributes are unchanged.Added
TestXMLNamespacedAttr, which fails on the previous code and passes with the fix. Existing attribute tests still pass.