pub struct SchemaDocument {Show 21 fields
pub id: DocumentId,
pub base_uri: String,
pub declared_target_namespace: Option<NameId>,
pub target_namespace: Option<NameId>,
pub version: Option<String>,
pub element_form_default: FormChoice,
pub attribute_form_default: FormChoice,
pub block_default: DerivationSet,
pub final_default: DerivationSet,
pub schema_id: Option<String>,
pub xml_lang: Option<String>,
pub default_attributes: Option<QualifiedName>,
pub xpath_default_namespace: Option<NameId>,
pub includes: Vec<IncludeDirective>,
pub imports: Vec<ImportDirective>,
pub redefines: Vec<RedefineDirective>,
pub overrides: Vec<OverrideDirective>,
pub default_open_content: Option<DefaultOpenContent>,
pub annotations: Vec<Annotation>,
pub component_index: DocumentComponentIndex,
pub source: Option<SourceRef>,
}Expand description
A single schema document (root or included/imported)
Represents one XSD file with its components and directives.
Fields§
§id: DocumentIdDocument ID for source map reference
base_uri: StringBase URI (location) of this document
declared_target_namespace: Option<NameId>The targetNamespace as declared in the <xs:schema> element.
None when the schema document omits targetNamespace.
Preserved even after chameleon adoption so the original fact
“this document had no declared namespace” is never lost.
target_namespace: Option<NameId>Effective target namespace after chameleon pre-processing (§4.2.3).
Equals declared_target_namespace for non-chameleon documents;
set to the includer’s namespace for chameleon-adopted documents.
version: Option<String>Schema-level attributes
element_form_default: FormChoice§attribute_form_default: FormChoice§block_default: DerivationSet§final_default: DerivationSet§schema_id: Option<String>§xml_lang: Option<String>§default_attributes: Option<QualifiedName>XSD 1.1: Default attributes group reference
xpath_default_namespace: Option<NameId>XSD 1.1: Default namespace for XPath
includes: Vec<IncludeDirective>Composition directives (in document order)
imports: Vec<ImportDirective>§redefines: Vec<RedefineDirective>§overrides: Vec<OverrideDirective>§default_open_content: Option<DefaultOpenContent>XSD 1.1: Default open content
annotations: Vec<Annotation>Schema-level annotations
component_index: DocumentComponentIndexPer-document index of top-level components declared in this document.
Populated during assembly; used for document-scoped lookup in
apply_redefine() and apply_override().
source: Option<SourceRef>Source reference for error reporting
Implementations§
Source§impl SchemaDocument
impl SchemaDocument
Sourcepub fn is_chameleon(&self) -> bool
pub fn is_chameleon(&self) -> bool
Whether this document had no declared targetNamespace and adopted
one via chameleon include pre-processing (§4.2.3 clause 2.3).
Sourcepub fn can_see_namespace(
&self,
qname_ns: Option<NameId>,
name_table: &NameTable,
) -> bool
pub fn can_see_namespace( &self, qname_ns: Option<NameId>, name_table: &NameTable, ) -> bool
Per-document QName visibility per XSD §3.17.6.2 src-resolve clause 4.
Returns true when a QName whose resolved namespace is qname_ns
may be referenced from this schema document. Resolution is strictly
per-document and lexical: imports are not transitive.
Reads declared_target_namespace for clause 4.1.1 / 4.2.1 so chameleon
includes (no declared targetNamespace) take 4.1.1 for absent-NS QNames
instead of failing 4.2.1 against the includer’s NS. For chameleon docs
whose QNames were rewritten by §4.2.3 adoption to the includer’s NS,
also accept the post-adoption target_namespace.
Sourcepub fn new(id: DocumentId, base_uri: String) -> Self
pub fn new(id: DocumentId, base_uri: String) -> Self
Create a new schema document