Skip to main content

Module builder

Module builder 

Source
Expand description

SchemaSet builder with compile() pattern

Provides a fluent API for loading multiple schemas before compilation, similar to .NET’s XmlSchemaSet pattern.

XSD version is set on the builder — the parser derives it automatically. Use SchemaSetBuilder::xsd11() for XSD 1.1, SchemaSetBuilder::new() for XSD 1.0.

§Example

use xsd_schema::SchemaSetBuilder;

let compiled = SchemaSetBuilder::new()
    .add_source(r#"<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
        <xs:element name="root" type="xs:string"/>
    </xs:schema>"#, "schema.xsd")
    .expect("parse failed")
    .compile()
    .expect("compile failed");

println!("Loaded {} documents", compiled.stats.documents_loaded);

Structs§

CompilationStats
Statistics from schema compilation.
CompiledSchemaSet
Compiled schema set ready for validation.
SchemaSetBuilder
Builder for creating compiled schema sets.