Skip to content

serial: emit xmlns="" undeclaration in exclusive c14n#16

Open
williamareynolds wants to merge 1 commit intojonwiggins:mainfrom
williamareynolds:wr/exc-c14n-undecl
Open

serial: emit xmlns="" undeclaration in exclusive c14n#16
williamareynolds wants to merge 1 commit intojonwiggins:mainfrom
williamareynolds:wr/exc-c14n-undecl

Conversation

@williamareynolds
Copy link
Copy Markdown
Contributor

Summary

Emit xmlns="" when a child element is in no namespace under a parent whose default namespace is in scope.

Type of Change

  • Bug fix (corrects an existing issue)
  • New feature (adds new functionality)
  • Conformance fix (aligns behavior with the W3C spec or libxml2)
  • Refactoring (no functional change)
  • Documentation (docs, comments, examples)
  • CI / tooling (build scripts, workflows, hooks)

Spec Reference

  • Spec: Canonical XML 1.0
  • Section: 2.3

Namespace Axis- Consider a list L containing only namespace nodes in the axis and in the node-set in lexicographic order (ascending). To begin processing L, if the first node is not the default namespace node (a node with no namespace URI and no local name), then generate a space followed by xmlns="" if and only if the following conditions are met:

  • the element E that owns the axis is in the node-set
  • The nearest ancestor element of E in the node-set has a default namespace node in the node-set (default namespace nodes always have non-empty values in XPath)

Test Plan

  • Added unit tests
  • Added roundtrip test (parse -> serialize -> parse -> compare)
  • Added regression test for the bug being fixed
  • Verified against W3C Conformance Test Suite
  • Tested manually with xmllint

If I have a little bit of extra time this week, I can work on wiring up a C14N conformance test. Maybe also an xmllint-libxml differential test? Let me know if that'd be helpful.

Checklist

  • Code is formatted (cargo fmt --all)
  • No clippy warnings (cargo clippy --all-targets --all-features -- -D warnings)
  • All tests pass (cargo test --all-features)
  • Documentation updated for any public API changes
  • Commit messages follow the <module>: <summary> convention
  • No new dependencies added (or discussed and approved in an issue)

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.

1 participant