Skip to main content

Module xml

Module xml 

Source
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§

NodeKind
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 xml prefix everywhere.

Functions§

escape_attribute
Escapes text for use in a double-quoted attribute value.
escape_text
Escapes text for use in element content.