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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
//! XML Schema (XSD) 1.1 validation.
//!
//! This module implements validation of XML documents against XSD schemas.
//! It covers:
//!
//! - **Part 1 (Structures)**: Complex types, simple types, elements, attributes,
//! sequences, choices, all groups, minOccurs/maxOccurs, mixed content.
//! - **Part 2 (Datatypes)**: Built-in primitive types (string, boolean, decimal,
//! float, double, integer, date, dateTime, etc.) and facet-based restrictions
//! (minLength, maxLength, pattern, enumeration, minInclusive, maxInclusive, etc.).
//!
//! # Usage
//!
//! ```
//! use uppsala::{parse, xsd::XsdValidator};
//!
//! let schema_xml = r#"
//! <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
//! <xs:element name="root" type="xs:string"/>
//! </xs:schema>
//! "#;
//!
//! let doc_xml = "<root>hello</root>";
//!
//! let schema = parse(schema_xml).unwrap();
//! let doc = parse(doc_xml).unwrap();
//! let validator = XsdValidator::from_schema(&schema).unwrap();
//! let errors = validator.validate(&doc);
//! assert!(errors.is_empty());
//! ```
// ── Internal debug logging ───────────────────────────────────────────────────
//
// Trace logging used by the validator submodules during diagnosis. Enabled
// only when the `debug-logging` Cargo feature is on so library output
// stays clean by default.
// Submodule declarations — each file contains a logical slice of the XSD validator.
/// Arbitrary-precision decimal string comparison utilities.
/// Date, time, and duration validation helpers for XSD built-in temporal types.
/// Core type definitions: structs, enums, and data structures used throughout the
/// XSD validator (XsdValidator, ElementDecl, TypeDef, ComplexTypeDef, etc.).
pub
/// Wildcard namespace constraint helpers: intersection, union, and match checking.
/// Built-in type validation, facet enforcement, and whitespace normalization.
/// Post-processing passes that resolve item-type facets for list types.
/// Identity constraint evaluation (xs:key, xs:unique, xs:keyref) with restricted
/// XPath selector/field processing.
/// Schema builder: `XsdValidator::from_schema()` and resolution passes.
/// Schema composition: xs:include, xs:import, xs:redefine with external file
/// loading, chameleon namespace fixup, and declaration merging.
/// Schema element/type/attribute/group parsing from DOM nodes.
/// Instance document validation: element, attribute, content model, and simple
/// content validation logic.
/// Unit tests for the XSD validator.
// ── Constants ────────────────────────────────────────────────────────────────
/// The XML Schema namespace URI (`xs:` / `xsd:`).
pub const XS_NAMESPACE: &str = "http://www.w3.org/2001/XMLSchema";
/// The XML Schema Instance namespace URI (`xsi:`).
pub const XSI_NAMESPACE: &str = "http://www.w3.org/2001/XMLSchema-instance";
// ── Re-exports ───────────────────────────────────────────────────────────────
/// The primary public type: construct via `XsdValidator::from_schema()` and call
/// `validator.validate(&doc)` to obtain a list of validation errors.
pub use XsdValidator;