Skip to main content

uor_addr/xml/
mod.rs

1//! **`uor_addr::xml` — the XML realization of UOR-ADDR**
2//! (ARCHITECTURE.md "Format-specific realizations" § `uor-addr-xml`).
3//!
4//! XML typed-input content-addressing under a **subset** of
5//! W3C Canonical XML 1.1 (XML-C14N 1.1), with the σ-projection bound
6//! to `prism::crypto::Sha256Hasher`.
7//!
8//! ## Authoritative sources
9//!
10//! - **W3C Canonical XML Version 1.1** — Recommendation 2 May 2008
11//!   (<https://www.w3.org/TR/xml-c14n11/>).
12//! - **W3C XML 1.0 (Fifth Edition)** — base syntax
13//!   (<https://www.w3.org/TR/xml/>).
14//! - **SHA-256 σ-projection** — NIST FIPS 180-4
15//!   (<https://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.180-4.pdf>).
16//!
17//! ## Supported canonical-XML subset
18//!
19//! Per ARCHITECTURE.md the typed-input shape `XmlValue` is a
20//! `partition_coproduct!` over five XML grammar cases (Element,
21//! Attribute, Text, CDATA, ProcessingInstruction). The shipped
22//! conformance subset implements the rules in XML-C14N 1.1 §1.1 that
23//! apply to structurally-typed XML — without external entities,
24//! DTDs, or namespace-prefix manipulation, which are out of scope
25//! for typed content-addressing:
26//!
27//! 1. Elements are emitted as `<name>...</name>` with no namespace
28//!    prefixes (the typed input shape does not carry namespace
29//!    qualification).
30//! 2. Attributes are emitted in **lexicographic byte order** by
31//!    attribute name per XML-C14N 1.1 §1.1 rule 3.
32//! 3. Attribute values are double-quoted; the value bytes are
33//!    character-escaped per XML-C14N 1.1 §1.1 rule 4 (`<` → `&lt;`,
34//!    `>` → `&gt;`, `&` → `&amp;`, `"` → `&quot;`, `\t` → `&#x9;`,
35//!    `\n` → `&#xA;`, `\r` → `&#xD;`).
36//! 4. Text content is character-escaped per the C14N 1.1 §1.1 rule 5
37//!    (`<` → `&lt;`, `>` → `&gt;`, `&` → `&amp;`, `\r` → `&#xD;`).
38//! 5. CDATA sections are expanded to text content before
39//!    canonicalization (XML-C14N 1.1 §1.1 — CDATA is informationally
40//!    equivalent to escaped text).
41//! 6. Processing instructions are emitted as `<?target data?>`.
42//!
43//! ## Out-of-scope rules (documented deviations)
44//!
45//! The shipped canonicalizer does **not** handle: namespace prefix
46//! rewriting (we don't admit namespaced input), DTD-internal entity
47//! resolution (we don't admit DTDs), `xml:` reserved attributes
48//! beyond the structural typing the parser enforces, and document
49//! whitespace outside element content (we admit only element
50//! content). These rules apply to deserialization from arbitrary XML
51//! 1.0 documents — out of scope for the typed-input pipeline.
52//! Conformance tests pin the supported subset; the deviation is
53//! documented in [STANDARDS.md](https://github.com/UOR-Foundation/uor-addr/blob/main/STANDARDS.md).
54
55pub mod model;
56pub mod pipeline;
57pub mod shapes;
58pub mod value;
59pub mod verbs;
60
61pub use model::{
62    AddressModel, AddressModelBlake3, AddressModelKeccak256, AddressModelSha3_256,
63    AddressModelSha512, AddressRoute,
64};
65#[cfg(feature = "alloc")]
66pub use pipeline::{address, address_blake3, address_keccak256, address_sha3_256, address_sha512};
67pub use pipeline::{AddressFailure, AddressOutcome, AddressWitness, VerifyError};
68pub use shapes::MAX_XML_DEPTH;
69#[cfg(feature = "alloc")]
70pub use value::canonicalize;
71pub use value::XmlValue;
72pub use verbs::{address_inference, VERB_TERMS_ADDRESS_INFERENCE};
73
74/// The shared, format-independent ψ-tower (re-exported for convenience;
75/// canonical path is [`crate::resolvers::AddressResolverTuple`]).
76pub use crate::resolvers::AddressResolverTuple;