Expand description
Validate TEI XML documents against RELAX NG schemas, in pure Rust.
With the schematron feature (on by default), the ISO Schematron rules
a schema embeds in either syntax, as TEI ODD-generated schemas do, are
checked too; see Schema::set_schematron and the schematron module.
let schema = teixml::Schema::from_file("tei_all.rng")?;
let xml = std::fs::read_to_string("edition.xml")?;
for diagnostic in schema.validate_str(&xml)? {
println!("{}: {diagnostic}", diagnostic.severity());
}Re-exports§
pub use relaxng::ElementPath;pub use store::SchemaStore;
Modules§
- relaxng
- A pure-Rust implementation of RELAX NG.
- schematron
- ISO Schematron rules embedded in RELAX NG schemas, as TEI ODD-generated schemas carry them.
- store
- A local store of RELAX NG schemas, so documents can be validated against
the schema they declare (
<?xml-model href="…"?>) without network access. - sync
- Keeping a
SchemaStoreup to date: fetches each schema from its canonical URL (or a mirror), compares it, and every file itincludes, with the stored copy, and optionally writes the new version.
Structs§
- Diagnostic
- One validation problem in a document.
- Position
- A 1-based line and column in the source document.
- Schema
- A compiled RELAX NG schema, ready to validate documents.
Enums§
- Diagnostic
Kind - What a diagnostic is about, and where it comes from.
- Error
- Why a schema or document couldn’t be processed at all.
- Severity
- How serious a diagnostic is. RELAX NG errors are always errors;
Schematron messages take theirs from the test’s
role.
Constants§
- MAX_
DOCUMENT_ DEPTH - How deeply a document’s elements may nest; deeper documents are rejected
with
Error::Xml. Real TEI documents nest a few dozen levels.