Skip to content

feat(c14n): xml:* attribute inheritance + C14N 1.1 xml:base fixup for document subsets #11

@polaz

Description

@polaz

Summary

Implement W3C C14N spec requirements for document subsets:

  1. xml: attribute inheritance (G001)* — When Inclusive C14N processes a document subset and an element's parent is NOT in the node set, inheritable xml:* attributes from ancestor elements are propagated to the topmost included element per W3C C14N §2.4:

    • C14N 1.0: xml:lang, xml:space, xml:base
    • C14N 1.1: adds xml:id to the above
    • Exclusive C14N omits this inheritance entirely per Exc-C14N §3
  2. C14N 1.1 mode enabled (P1-007) — Previously returned UnsupportedAlgorithm. Now routes to inclusive renderer with xml:id propagation and xml:base URI resolution

  3. xml:base URI fixup (G004) — C14N 1.1 resolves relative xml:base URIs in document subsets via RFC 3986 §5. The effective URI is absolute only if the ancestor chain includes a scheme-bearing base; otherwise it may remain relative. Both inherited and own xml:base values are resolved against the effective ancestor chain

Test Plan

  • 9 unit tests for xml:* inheritance (serialize.rs) — including no-inheritance-past-included-ancestor
  • 5 unit tests for C14N 1.1 mode (mod.rs)
  • 27 unit tests for RFC 3986 URI resolver (xml_base.rs) — including schemeless base, file: scheme, empty xml:base
  • 9 integration tests for C14N 1.1 + xml:base fixup (c14n_integration.rs)
  • All 148 tests pass, clippy clean

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions