Expand description
Schema resolution for include, import, and redefine directives
This module handles resolving and loading external schema documents
referenced by xs:include, xs:import, and xs:redefine directives.
§Resolution Process
-
Include - Same target namespace, required schemaLocation
- Loads the referenced schema
- Merges components into the same namespace
- Supports chameleon includes (no targetNamespace)
-
Import - Different namespace, optional schemaLocation
- Loads schema for the specified namespace
- Components remain in their declared namespace
- Without schemaLocation, relies on catalog or pre-loaded schemas
-
Redefine - Same namespace, extends/restricts existing types
- Deprecated in XSD 1.1 (use override instead)
- Allows redefining types/groups from included schema
§Circular Dependencies
The resolver tracks loaded schema locations to:
- Detect circular includes (allowed, just skip)
- Prevent infinite loops
- Enable caching of resolved schemas
§URI Resolution
The resolver supports:
- Absolute file paths
- Relative paths (resolved against base URI)
- HTTP/HTTPS URLs (via async trait)
- Catalog-based resolution
§Customizable Loading
The SchemaLoader trait allows custom loading strategies:
FileSystemLoader- Loads from local file systemEmbeddedLoader- Loads from embedded static assetsLoaderChain- Combines multiple loaders with priority
Structs§
- Catalog
Entry - A single catalog entry
- Embedded
Loader - Embedded resource loader for built-in schemas.
- File
System Loader - File system schema loader (default).
- Loader
Chain - Composite loader that chains multiple loaders.
- Resolution
Result - Result of resolving all directives in a schema
- Resolver
Config - Configuration for schema resolution
- Schema
Catalog - Catalog for mapping namespaces to schema locations
- Schema
Resolver - Schema resolver for loading external schema documents.
Enums§
- Load
Outcome - Result of a single
load_schemacall, distinguishing three outcomes.
Traits§
- Schema
Loader - Trait for loading schema content from various sources.
Functions§
- decode_
xml_ bytes - Decode raw XML bytes into a UTF-8
String, sniffing common Unicode encodings per XML 1.0 §F.1. Seedecode_xml_to_utf8_bytes. - decode_
xml_ to_ utf8_ bytes - Decode raw XML bytes into UTF-8 bytes, sniffing common Unicode encodings per XML 1.0 §F.1.
- fixup_
composition_ edges - Fixup pass: fill in
target_docon cycle edges whose target has since been loaded. Call after all directive resolution rounds complete. - resolve_
all_ directives - Resolve all directives in a schema document