Skip to content

Fix default namespace handling for prefixed XML names - #244

Open
Aschenbath wants to merge 1 commit into
oozcitak:masterfrom
Aschenbath:codex/fix-xmlbuilder2-243
Open

Aschenbath wants to merge 1 commit into
oozcitak:masterfrom
Aschenbath:codex/fix-xmlbuilder2-243

Conversation

@Aschenbath

Copy link
Copy Markdown

Fixes #243.

Parsing <p:a xmlns:p="urn:u" xmlns="urn:v"> now keeps p:a and prefixed children in urn:u, regardless of declaration order. An empty default namespace no longer rejects a prefixed element, and prefixed attributes retain their namespace when its URI also serves as the default namespace.

Apply the default namespace only to unprefixed element names, and resolve ordinary attribute namespaces only through their prefixes. Add 17 issue regressions covering declaration and attribute ordering, empty/shared default namespaces, inheritance, unprefixed controls, and appended fragments.

Type of change:

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update

Validation on Windows, Node 24.22.0:

  • The new regressions fail 9/17 on the original implementation and pass 17/17 with the fix; the full suite passes 570/570.
  • TypeScript compilation and the coverage run completed. The browser build succeeded with dependency URL-export and bundle-size warnings.
  • An independent Python minidom comparison checked 180 documents and an appended fragment. All 180 serialized documents match; 175 DOM trees match. The five remaining DOM differences reproduce on the original implementation (implicit xml bindings and attributes preceding a local prefix rebinding); 89 formerly failing documents now match completely.
  • A separately installed tarball and its browser-global bundle pass 8,646 namespace/order cases with 77,802 assertions. The Node consumer uses the same tsx loader family as the upstream tests and a supplementary CommonJS compilation. Plain Node loading fails on existing extensionless imports in @oozcitak/infra; this does not establish native CommonJS package compatibility. The build configuration is unchanged.

The upstream Node 22/24 Linux/macOS CI matrix was not run locally. This change and its tests were prepared with OpenAI Codex; no human review is claimed.

This branch has not been deployed

No deployments
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.

XML reader applies xmlns="..." to prefixed elements and attributes

1 participant