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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
//! Schematron: rule-based XML validation, in pure Rust.
//!
//! This crate implements ISO/IEC 19757-3 Schematron with no C dependency, no
//! XSLT processor, and no FFI. It contains its own XML parser, its own XPath
//! 1.0 engine, and its own validator, so a Schematron schema is *interpreted*
//! directly rather than transpiled into XSLT the way the reference
//! implementation does.
//!
//! # What Schematron is for
//!
//! Grammar languages — DTD, XML Schema, RELAX NG — describe the shape a
//! document may take. Schematron describes constraints the document must
//! satisfy, written as XPath expressions, so it can express things a grammar
//! cannot: co-occurrence rules, value relationships, cross-references, and
//! conditions that span documents.
//!
//! # Example
//!
//! ```
//! use schematron::{Document, Schema};
//!
//! let schema = Schema::from_str(r#"
//! <schema xmlns="http://purl.oclc.org/dsdl/schematron">
//! <pattern>
//! <rule context="invoice">
//! <assert test="total">An invoice must have a total.</assert>
//! </rule>
//! </pattern>
//! </schema>
//! "#)?;
//!
//! let good = Document::from_str("<invoice><total>10</total></invoice>")?;
//! assert!(schema.validate(&good)?.is_valid());
//!
//! let bad = Document::from_str("<invoice/>")?;
//! let report = schema.validate(&bad)?;
//! assert!(!report.is_valid());
//! assert_eq!(report.failures().next().unwrap().text, "An invoice must have a total.");
//! # Ok::<(), schematron::Error>(())
//! ```
//!
//! # The one rule to internalise
//!
//! 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. Putting
//! two independent checks for the same element in one pattern silently
//! disables the second. See `spec/validation.md`.
//!
//! # Layout
//!
//! - [`xml`] — the XML parser and XPath data model
//! - [`xpath`] — the XPath 1.0 engine
//! - [`schema`] — the Schematron document model and its compiler
//! - [`validate`] — the validator and its report types
//! - [`svrl`] — SVRL report output
//!
//! Most callers need only [`Schema`], [`Document`], and [`Report`].
pub use ;
pub use ;
pub use ;
pub use SvrlOptions;
pub use TextOptions;
pub use ;
pub use Document;