Skip to content

Restore namespace aliases after leaving a child element - #144

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

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

Conversation

@rudycelekli

@rudycelekli rudycelekli commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

A child namespace alias for an existing URI overwrites the parser's URI-to-prefix mapping after that child closes. A later sibling can lose its element namespace and serialize an attribute with an out-of-scope prefix. Keep a per-element undo set and restore aliases on the end token. Tests use encoding/xml as an independent expanded-name oracle, cover namespaced attributes, nested aliases, default-namespace control, and streaming records. This does not attempt to redesign the existing multiple-alias selection within a single scope.

Validation at 247cec34a70e322dc4a2bb8d4aa71def62181357 (base 9429919ed0a2c62f385c010f24095a149a2d672a):

  • Added regression fails on the unchanged base.
  • go test ./... -count=1 passes.
  • go test -race ./... -count=1 passes.
  • git diff --check passes.

Checks above ran locally on macOS; hosted CI and maintainer review remain separate. Prepared and independently reviewed with Codex assistance.

Related: #79 proposes recovering the lexical element prefix from the raw tag. This change restores the scoped URI-to-prefix metadata itself, including attribute serialization and streaming records; it does not redesign alias selection within a single scope. The existing default-namespace sibling case is retained as a control.

@zhengchun
zhengchun merged commit 066fe6e 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