Expand description
A pure Rust XML parser and XPath 1.0 data model.
Schematron is defined over the XPath data model, so validating a document needs a tree with all seven XPath node kinds, correct namespace scoping, and a stable document order — not a stream of events. This module provides exactly that and nothing more; it is not a general-purpose XML toolkit.
See spec/xml/ for the design and its deliberate limits.
§Examples
use schematron::xml::Document;
let doc = Document::from_str("<invoice><total>10.00</total></invoice>")?;
let invoice = doc.document_element().unwrap();
let total = doc.children(invoice)[0];
assert_eq!(doc.string_value(total), "10.00");Structs§
- Document
- A parsed XML document, stored as an arena of nodes.
- NodeId
- A handle to a node inside a
Document. - QName
- An expanded name: an optional namespace URI plus a local part, with the prefix retained for display.
Enums§
- Node
Kind - The seven node kinds of the XPath 1.0 data model.
Constants§
- MAX_
DEPTH - The maximum element nesting depth accepted.
- XMLNS_
NAMESPACE - The namespace URI for namespace declarations themselves.
- XML_
NAMESPACE - The XML namespace URI, bound implicitly to the
xmlprefix everywhere.
Functions§
- escape_
attribute - Escapes text for use in a double-quoted attribute value.
- escape_
text - Escapes text for use in element content.