1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
//! The Schematron document model and its compiler.
//!
//! A `.sch` file becomes a runnable [`Schema`] in five passes, described in
//! `spec/parsing/`:
//!
//! 1. Parse the schema as XML.
//! 2. Resolve `include` and `extends href`.
//! 3. Build the [`SchemaModel`] and check Schematron's own content model.
//! 4. Expand abstract rules and abstract patterns.
//! 5. Parse every XPath expression, once, and check what can be checked
//! statically: function names, arities, namespace prefixes, id references.
//!
//! The result is immutable and `Send + Sync`. Compile once, validate many.
//!
//! # Examples
//!
//! ```
//! use schematron::Schema;
//!
//! let schema = Schema::from_str(r#"
//! <schema xmlns="http://purl.oclc.org/dsdl/schematron" defaultPhase="quick">
//! <phase id="quick"><active pattern="structure"/></phase>
//! <pattern id="structure">
//! <rule context="invoice"><assert test="total">Needs a total.</assert></rule>
//! </pattern>
//! </schema>
//! "#)?;
//!
//! assert_eq!(schema.default_phase(), Some("quick"));
//! assert_eq!(schema.phases().collect::<Vec<_>>(), vec!["quick"]);
//! # Ok::<(), schematron::Error>(())
//! ```
pub use ;
pub use ;
pub use ;