Skip to main content

SchemaDocument

Struct SchemaDocument 

Source
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: DocumentId

Document ID for source map reference

§base_uri: String

Base 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: DocumentComponentIndex

Per-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

Source

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).

Source

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.

Source

pub fn new(id: DocumentId, base_uri: String) -> Self

Create a new schema document

Trait Implementations§

Source§

impl Debug for SchemaDocument

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> MaybeSendSync for T

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.