Skip to main content

Module xsd

Module xsd 

Source
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§

FacetSet
Set of facets layered on a SimpleType. Empty for the bare built-ins.
FacetViolation
Returned by Facet::check when a facet rejects a value.
FsResolver
Look for schema files on the filesystem relative to a base directory.
InMemoryResolver
Map literal schemaLocation strings 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_str for single-file schemas — any <xs:import> or <xs:include> becomes a compile error.
PsviTypes
Post-schema-validation type annotations produced by Schema::validate_doc_typed.
SchemaCompileError
Error returned by Schema::compile_str and friends. Schema compilation produces at most one error — the compiler bails on the first problem since later phases assume a well-formed type graph.
ValidationError
Returned by Schema::validate_str. May contain one or many issues depending on ValidationOptions::fail_fast.
ValidationIssue
One validation problem discovered while walking an instance document.
ValidationOptions
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).
TimezoneRequirement
Value of the xs:explicitTimezone facet — XSD 1.1 § 4.3.13.
ValidationKind
Categorical tag for a validation issue. Use for programmatic dispatch rather than string-matching the message.
WhitespaceMode
The three whitespace-handling modes defined by XSD §4.3.6.

Traits§

SchemaResolver
Resolves a schema-location hint to the XSD bytes for that schema.