Expand description
XML Schema 1.0 — schema compiler and instance validator.
This module is feature-gated behind xsd. The public surface is small:
ⓘ
use sup_xml_core::xsd::Schema;
let schema = Schema::compile_str(xsd_text)?;
schema.validate_str(instance_xml)?;See thoughts/xsd_plan.txt in the repo for the full architecture and
scope.
Re-exports§
pub use crate::regex;pub use identity::ConstraintKind;pub use identity::IdentityConstraint;pub use identity::FieldPath;pub use identity::NameTest;pub use identity::PathExpr;pub use identity::PathStep;pub use identity::SelectorPath;pub use schema::AttributeDecl;pub use schema::AttributeGroup;pub use schema::AttributeUse;pub use schema::AttributeUseKind;pub use schema::BlockSet;pub use schema::ContentModel;pub use schema::ElementDecl;pub use schema::GroupKind;pub use schema::MaxOccurs;pub use schema::ModelGroup;pub use schema::NamespaceConstraint;pub use schema::NotationDecl;pub use schema::Particle;pub use schema::ProcessContents;pub use schema::QName;pub use schema::Schema;pub use schema::SchemaOptions;pub use schema::SchemaVersion;pub use schema::Term;pub use schema::TypeRef;pub use schema::Wildcard;pub use types::BuiltinType;pub use types::ComplexType;pub use types::Derivation;pub use types::DerivationMethod;pub use types::SimpleType;pub use types::TypeDef;pub use types::Value;
Modules§
- datetime
- XSD date/time/duration parsers.
- dfa
- Deterministic finite automaton for content-model matching.
- identity
- Identity constraints —
<xs:key>/<xs:keyref>/<xs:unique>. - schema
- Compiled-schema data structures.
- types
- Core type-system data structures.
Structs§
- Facet
Set - Set of facets layered on a
SimpleType. Empty for the bare built-ins. - Facet
Violation - Returned by
Facet::checkwhen a facet rejects a value. - FsResolver
- Look for schema files on the filesystem relative to a base directory.
- InMemory
Resolver - Map literal
schemaLocationstrings to schema bytes held in memory. Useful for embedding schemas in a binary, for tests, or for proxying to an in-process schema cache. - NoResolver
- A resolver that always declines. Used by
Schema::compile_strfor single-file schemas — any<xs:import>or<xs:include>becomes a compile error. - Psvi
Types - Post-schema-validation type annotations produced by
Schema::validate_doc_typed. - Schema
Compile Error - Error returned by
Schema::compile_strand friends. Schema compilation produces at most one error — the compiler bails on the first problem since later phases assume a well-formed type graph. - Validation
Error - Returned by
Schema::validate_str. May contain one or many issues depending onValidationOptions::fail_fast. - Validation
Issue - One validation problem discovered while walking an instance document.
- Validation
Options - Tunables for
Schema::validate_str_opts.
Enums§
- Facet
- One facet constraint. Multiple facets of the same kind on one type are collapsed by the schema compiler into the most-restrictive single value (XSD §4.3 derivation rules).
- Timezone
Requirement - Value of the
xs:explicitTimezonefacet — XSD 1.1 § 4.3.13. - Validation
Kind - Categorical tag for a validation issue. Use for programmatic dispatch rather than string-matching the message.
- Whitespace
Mode - The three whitespace-handling modes defined by XSD §4.3.6.
Traits§
- Schema
Resolver - Resolves a schema-location hint to the XSD bytes for that schema.