Skip to main content

canonicalize

Function canonicalize 

Source
pub fn canonicalize(raw: &[u8]) -> Result<Vec<u8>, ShapeViolation>
Expand description

Parse + canonicalize per the W3C XML-C14N 1.1 subset documented in crate::xml. Single recursive-descent pass over raw that emits the canonical form directly — no fixed buffer, no width/count caps.

Available only under the alloc feature. The model handle (XmlValue) is no_alloc; canonicalization itself needs heap storage (per-element attribute sort scratch + the canonical output).

§Errors

  • [INVALID_XML_VIOLATION] (validXml) — raw is not a well-formed UTF-8 document in the supported subset.
  • [DEPTH_BOUND_VIOLATION] (depthBound) — nesting exceeds the MAX_XML_DEPTH native-stack-safety bound.