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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
//! XSD 1.0 Schema Parser and Validator
//!
//! This crate provides a complete XSD 1.0 schema parser with structural validation,
//! namespace management, and W3C conformance testing. It follows the design specifications
//! in the XSD_*.md documentation files.
//!
//! # Entry Points
//!
//! ## Single Schema (Recommended)
//!
//! Use [`load_and_process_schema`] for complete processing of a single schema.
//! XSD version is set on `SchemaSet` — the parser derives it automatically.
//!
//! ```
//! use xsd_schema::{SchemaSet, load_and_process_schema};
//!
//! // Use SchemaSet::new() for XSD 1.0, SchemaSet::xsd11() for XSD 1.1
//! let mut schema_set = SchemaSet::new();
//! let xml = r#"<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
//! <xs:element name="root" type="xs:string"/>
//! </xs:schema>"#;
//!
//! let stats = load_and_process_schema(xml.as_bytes(), "schema.xsd", &mut schema_set, None)
//! .expect("failed to load schema");
//! assert_eq!(stats.doc_id, 0);
//! ```
//!
//! ## Multiple Related Schemas
//!
//! For loading multiple schema files, use the two-phase approach:
//!
//! ```
//! use xsd_schema::{SchemaSet, parse_schema_only, process_loaded_schemas};
//!
//! let mut schema_set = SchemaSet::new();
//!
//! let schemas = [
//! (r#"<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
//! targetNamespace="urn:schema1">
//! <xs:element name="item1" type="xs:string"/>
//! </xs:schema>"#, "schema1.xsd"),
//! (r#"<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
//! targetNamespace="urn:schema2">
//! <xs:element name="item2" type="xs:int"/>
//! </xs:schema>"#, "schema2.xsd"),
//! ];
//!
//! // Phase 1: Parse all schemas
//! for (xml, uri) in schemas {
//! parse_schema_only(xml.as_bytes(), uri, &mut schema_set).expect("parse failed");
//! }
//!
//! // Phase 2: Process all schemas together
//! // (redefine/override application, inline assembly, reference resolution)
//! // Note: all participating schemas — including redefine/override targets —
//! // must be parsed before calling this function.
//! let (inline_stats, resolution_stats) = process_loaded_schemas(&mut schema_set)
//! .expect("processing failed");
//! ```
//!
//! ## Advanced: Low-Level Parser
//!
//! For custom pipelines, the low-level parser is available at [`parser::parse_schema`].
//! This only performs Phase 1 (parsing + assembly) - subsequent phases must be run manually.
//!
//! # Architecture
//!
//! The parser uses a state machine approach with typed parser frames for each XSD element type.
//! All schema components are stored in arenas with typed IDs to avoid reference cycles.
//!
//! ## Core Modules
//!
//! - `parser` - XSD document parsing with location tracking
//! - `namespace` - String interning and namespace management
//! - `schema` - Schema component model (elements, types, groups)
//! - `types` - Type definitions and facets
//!
//! # Example
//!
//! ```rust
//! use xsd_schema::SchemaSet;
//!
//! // Create an empty schema set
//! let mut schema_set = SchemaSet::new();
//!
//! // Schema parser will be added in later implementation
//! // For now, the schema set can be populated programmatically
//! ```
// Core type definitions
// Parser infrastructure
// Namespace management
// Schema component model
// DOM navigation (always available)
// XPath 2.0 engine (only with xsd11 feature)
// Page-based XML document buffer (only with xsd11 feature)
// Pipeline orchestration
// Embedded assets
// Builder pattern API
// Regex pattern conversion (shared between XSD and XPath)
pub
// NFA compiler for content models
// Instance validation
// Re-export primary types
pub use ;
pub use *;
pub use ;
// Re-export resolution and inline assembly
pub use ;
// Re-export XSD version
pub use XsdVersion;
// Re-export regex compatibility mode
pub use RegexCompat;
// Re-export type system enums
pub use ;
// Re-export facet types
pub use ;
// Re-export navigator types (always available)
pub use ;
// Re-export XPath types (only with xsd11 feature)
pub use ;
// Re-export pipeline functions
pub use ;
// Re-export async pipeline functions
pub use ;
// Re-export builder types
pub use ;
// Re-export resolver types
pub use ;
// Re-export async loader trait
pub use AsyncSchemaLoader;
// Re-export embedded assets
pub use ;
// Re-export compiler types
pub use ;
// Re-export instance validation types
// Note: ValidationError here is distinct from types::validators::ValidationError
pub use ;
// Re-export hint-driven schema loading
pub use ;
pub use ;