Skip to content

Keep namespace declarations out of the XPath attribute axis - #145

Merged
zhengchun merged 1 commit into
antchfx:masterfrom
rudycelekli:fix/xpath-namespace-attributes-20261101
Nov 7, 2026
Merged

zhengchun merged 1 commit into
antchfx:masterfrom
rudycelekli:fix/xpath-namespace-attributes-20261101

Conversation

@rudycelekli

Copy link
Copy Markdown
Contributor

An element's xmlns and xmlns:p declarations are currently returned by the XPath @* attribute axis. XPath1.0 §5.3 distinguishes namespace declarations from attribute nodes. This affects attribute counts, filters and positional selections on namespaced XML.

Skip namespace declarations when moving through XPath attributes, while leaving the source Node.Attr representation and XML serialization intact. The cursor also stays on its original node when an element has only namespace declarations and no XPath attributes.

Validation at 73607a8036bf2f8a860e40f95bfa19864102e032 (base 9429919ed0a2c62f385c010f24095a149a2d672a):

  • Both new regressions fail against unchanged upstream.
  • go test ./... -count=1 passes.
  • go test -race ./... -count=1 passes.
  • git diff --check passes.
  • Controls retain ordinary attributes, xml:lang, prefixed attributes and an ordinary p:xmlns attribute, all original source attributes and serialized namespace declarations.

This branch is independent of the other pending navigator changes. Checks ran locally on macOS; hosted CI and maintainer acceptance remain separate. Prepared and independently reviewed with Codex assistance.

@zhengchun
zhengchun merged commit c25e83d into antchfx:master Nov 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants