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
//! Validating documents, and the report that comes back.
//!
//! The algorithm is in `spec/validation.md`. The one rule to carry in your
//! head: **within a single pattern, each node is processed by at most one
//! rule — the first whose context matches it.** Rules in one pattern compete
//! like the arms of a match expression; rules in different patterns do not.
//!
//! # Examples
//!
//! ```
//! use schematron::{Document, Schema};
//! use schematron::validate::{PhaseSelection, ValidateOptions};
//!
//! let schema = Schema::from_str(r#"
//! <schema xmlns="http://purl.oclc.org/dsdl/schematron">
//! <phase id="strict"><active pattern="totals"/></phase>
//! <pattern id="totals">
//! <rule context="invoice">
//! <assert test="total">An invoice must have a total.</assert>
//! </rule>
//! </pattern>
//! </schema>
//! "#)?;
//!
//! let document = Document::from_str("<invoice/>")?;
//! let options = ValidateOptions::new().with_phase(PhaseSelection::Named("strict".into()));
//! let report = schema.validate_with(&document, &options)?;
//!
//! assert_eq!(report.count_failures(), 1);
//! assert_eq!(report.failures().next().unwrap().location, "/*:invoice[1]");
//! # Ok::<(), schematron::Error>(())
//! ```
pub use ;
pub use ;
pub use validate;