pub struct Schemas { /* private fields */ }
Expand description
Top-level structure for managing loaded XML schema files and associated namespaces.
This type is created and populated by the Parser
, and used
by the Interpreter
to resolve schema components into
meaningful Rust types.
It tracks all loaded schemas, the namespaces they belong to, and which prefixes
are associated with which namespace URIs. Each namespace and schema is assigned
a unique ID (NamespaceId
, SchemaId
) to allow efficient lookup and association.
This type supports iterating over loaded schemas and namespaces, as well as resolving prefixes and namespaces during interpretation.
Implementations§
Source§impl Schemas
impl Schemas
Sourcepub fn add_schema(
&mut self,
prefix: Option<NamespacePrefix>,
namespace: Option<Namespace>,
name: Option<String>,
schema: Schema,
location: Option<Url>,
)
pub fn add_schema( &mut self, prefix: Option<NamespacePrefix>, namespace: Option<Namespace>, name: Option<String>, schema: Schema, location: Option<Url>, )
Add a new schema to the schemas structure.
§Errors
Will just forward the errors from get_or_create_namespace_info_mut
.
Sourcepub fn get_or_create_namespace_info_mut(
&mut self,
prefix: Option<NamespacePrefix>,
namespace: Option<Namespace>,
) -> (NamespaceId, &mut NamespaceInfo)
pub fn get_or_create_namespace_info_mut( &mut self, prefix: Option<NamespacePrefix>, namespace: Option<Namespace>, ) -> (NamespaceId, &mut NamespaceInfo)
Get a mutable reference to a NamespaceInfo
or create a new one if needed.
Sourcepub fn schemas(&self) -> Iter<'_, SchemaId, SchemaInfo>
pub fn schemas(&self) -> Iter<'_, SchemaId, SchemaInfo>
Returns an iterator over all schemas stored in this structure.
Sourcepub fn schemas_mut(&mut self) -> IterMut<'_, SchemaId, SchemaInfo>
pub fn schemas_mut(&mut self) -> IterMut<'_, SchemaId, SchemaInfo>
Returns a mutable iterator over all schemas stored in this structure.
Sourcepub fn namespaces(&self) -> Iter<'_, NamespaceId, NamespaceInfo>
pub fn namespaces(&self) -> Iter<'_, NamespaceId, NamespaceInfo>
Returns an iterator over all namespace information instances stored in this structure.
Sourcepub fn get_schema(&self, id: &SchemaId) -> Option<&SchemaInfo>
pub fn get_schema(&self, id: &SchemaId) -> Option<&SchemaInfo>
Returns a reference to a specific schema by using the schema id,
or None
if the schema is not known.
Sourcepub fn get_schema_mut(&mut self, id: &SchemaId) -> Option<&mut SchemaInfo>
pub fn get_schema_mut(&mut self, id: &SchemaId) -> Option<&mut SchemaInfo>
Returns a mutable reference to a specific schema by using the schema id,
or None
if the schema is not known.
Sourcepub fn get_namespace_info(&self, id: &NamespaceId) -> Option<&NamespaceInfo>
pub fn get_namespace_info(&self, id: &NamespaceId) -> Option<&NamespaceInfo>
Returns a reference to a specific namespace information instance by using the namespace id.
Sourcepub fn get_namespace_info_mut(
&mut self,
id: &NamespaceId,
) -> Option<&mut NamespaceInfo>
pub fn get_namespace_info_mut( &mut self, id: &NamespaceId, ) -> Option<&mut NamespaceInfo>
Returns a mutable reference to a specific namespace information instance by using the namespace id.
Sourcepub fn get_namespace_info_by_namespace(
&self,
ns: &Option<Namespace>,
) -> Option<&NamespaceInfo>
pub fn get_namespace_info_by_namespace( &self, ns: &Option<Namespace>, ) -> Option<&NamespaceInfo>
Returns a reference to a specific namespace information instance by using
the namespace URI, or None
if the schema is not known.
Sourcepub fn resolve_prefix(&self, prefix: &NamespacePrefix) -> Option<NamespaceId>
pub fn resolve_prefix(&self, prefix: &NamespacePrefix) -> Option<NamespaceId>
Try to resolve the namespace prefix to a namespace id.
Returns the namespace id of the given namespace prefix
, or None
.
Sourcepub fn resolve_namespace(&self, ns: &Option<Namespace>) -> Option<NamespaceId>
pub fn resolve_namespace(&self, ns: &Option<Namespace>) -> Option<NamespaceId>
Try to resolve the namespace to a namespace id.
Returns the namespace id of the given namespace ns
, or None
.