pub struct IdentQuadruple {
pub ns: Option<NamespaceIdent>,
pub schema: Option<SchemaIdent>,
pub name: String,
pub type_: IdentType,
}Expand description
Identifier that is used inside the config.
Each element in a XML schema is uniquely identified by the following four values: - The namespace of the element (or no namespace at all). - The schema the element was defined in. - The name of the element. - The type of element.
This struct is used to bundle these three information to a unique identifier for an element.
Fields§
§ns: Option<NamespaceIdent>Namespace where the type is defined in.
schema: Option<SchemaIdent>Id of the schema the type is defined in.
name: StringName of the type.
type_: IdentTypeType of the identifier (because pure names are not unique in XSD).
Implementations§
Source§impl IdentQuadruple
impl IdentQuadruple
Sourcepub fn new<S>(name: S, type_: IdentType) -> Self
pub fn new<S>(name: S, type_: IdentType) -> Self
Create a new IdentQuadruple instance from the passed name and type_.
Sourcepub fn with_ns<X>(self, ns: X) -> Selfwhere
X: Into<NamespaceIdent>,
pub fn with_ns<X>(self, ns: X) -> Selfwhere
X: Into<NamespaceIdent>,
Adds a NamespaceIdent to this identifier quadruple.
Sourcepub fn with_schema<X>(self, schema: X) -> Selfwhere
X: Into<SchemaIdent>,
pub fn with_schema<X>(self, schema: X) -> Selfwhere
X: Into<SchemaIdent>,
Adds a SchemaIdent to this identifier quadruple.
Sourcepub fn with_name<X>(self, name: X) -> Self
pub fn with_name<X>(self, name: X) -> Self
Sets the name of the type that is identified by this identifier quadruple.
Sourcepub fn with_type(self, type_: IdentType) -> Self
pub fn with_type(self, type_: IdentType) -> Self
Sets the identifier type of this identifier quadruple.
Sourcepub fn resolve(self, schemas: &Schemas) -> Result<TypeIdent, InterpreterError>
pub fn resolve(self, schemas: &Schemas) -> Result<TypeIdent, InterpreterError>
Resolve the quadruple to an actual type identifier that is available in the schema.
///
schema not fully
resolved. This can happen if you specified the wrong schema name, or schema
location. If you didn’t provide a SchemaIdent at all, the type is resolved
by it’s name, which is also not always successful, if the type is not defined
in the root of the available schemas.
If you use this to get suitable identifiers to define types for the interpreter
(see with_type), then you are fine, because
the interpreter will resolve unknown schema IDs by it’s own.
If you want to use the resolved identifier for selecting a MetaType
from the resulting MetaTypes structure created by
the interpreted, you have to resolve the type additionally using the
IdentCache, which is also returned by the
Interpreter
(see exec_interpreter_with_ident_cache).
§Errors
Returns an error if the namespace or the namespace prefix could not be resolved.
Trait Implementations§
Source§impl Clone for IdentQuadruple
impl Clone for IdentQuadruple
Source§fn clone(&self) -> IdentQuadruple
fn clone(&self) -> IdentQuadruple
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more