libxml-rs 0.1.0-alpha.33

Native-Rust forensic reimplementation of libxml2+libxslt with C ABI drop-in replacement. Cross-version oracle matrix (libxml2 2.7.8-2.15.3, libxslt 1.1.26-1.1.45) with semantic epochs correlated to upstream commits; full xmllint/xmlcatalog/xsltproc CLIs; differential-court-verified C API closure (xmlXPath*, xmlTextReader*, xmlTextWriter*, catalogs, serialization, data globals, chvalid, encoding, the full libxslt surface) — parity ledger at 0 missing for both libxml2 and libxslt; residual closure loop (73 FIXED / 2 bounded obligations) sealed by differential court matrix; C14N, format-number(), number(), compile-time XSLT select/test validation, and undefined-prefix QName preservation verified byte-identical against libxml2 2.15.3 / libxslt 1.1.45 oracle. 1177 tests passing.
Documentation
//! Namespace handling (§23, §85 Phase 2/3).
//!
//! Default namespace, prefixed namespace, namespace undeclaration, attribute
//! namespaces, duplicate declarations, shadowing, prefix reuse, conflicting
//! prefixes, orphaned namespace pointers, namespace reconciliation.
//!
//! Phase 0: scaffolded. Implementation begins in Phase 2/3.
//!
//! # Upstream contract
//!
//! Mirrors upstream namespaces.c (SRC-LIBXML2-2.15.0-NAMESPACES-C, oracle
//! tree `oracle/historical/src/libxml2-2.15.0/namespaces.c`): xmlNewNs,
//! xmlSetNs, xmlSearchNs, xmlSearchNsByHref, xmlGetNsList,
//! xmlReconciliateNs, xmlCopyNamespace[List], xmlFreeNs[List],
//! xmlNewGlobalNs.
//!
//! # Conceptual behavior
//!
//! Default namespace, prefixed namespace, namespace undeclaration, attribute
//! namespaces, duplicate declarations, shadowing, prefix reuse, conflicting
//! prefixes, orphaned namespace pointers and namespace reconciliation.
//! Namespace nodes live on node->nsDef chains and are resolved by walking the
//! element scope upward — the same model the parser and XPath rely on.
//!
//! # Ownership & safety invariants
//!
//! Ownership: an xmlNs created by xmlNewNs is owned by the node nsDef list
//! and freed with the node (xmlFreeNs only for unlinked standalone ns);
//! node->ns is a borrowed pointer. SAFETY: upstream xmlNs nodes have NO
//! parent pointer (QUIRK-0002 / LORE-0006) — the model must not invent one.
//!
//! # Historical quirks & epochs
//!
//! The no-parent namespace node is a long-standing upstream divergence fixed
//! only in the c14n birth commit 044fc6b7 (2002, issue #61290); downstream
//! XPath namespace-axis consumers depend on it. Epoch: unchanged across
//! 2.7.8 to 2.15.3 (stable case in the historical matrix).
//!
//! # Deliberate oddities
//!
//! The deliberately odd part is the nsDef-first resolution order used by
//! xmlSAX2AttributeNs (R-000147): scan the element-local declarations, then
//! fall back to the parent scope — the new element is not yet linked to its
//! parent when attributes are processed.
//!
//! # Proving courts
//!
//! Exercised by the TREE-NS-* and XPATH-NS-* court families (QUIRK-0002),
//! TREE-001 (nsDef duplicates, empty-value xmlns, default-ns handling),
//! READER-001 (attribute namespace accessors) and `cargo test --lib`.
//!
//! # Tempting simplifications that would break parity
//!
//! A tempting simplification is giving namespace nodes a parent pointer for
//! convenience — it would break XPath 1.0 namespace-axis semantics and the
//! TREE-NS-* courts. Do not deduplicate nsDef entries: upstream registers
//! each declaration once and TREE-001 fingerprints the exact chains.