pub struct XPathContext<'a> {
pub names: &'a NameTable,
pub schema_set: Option<&'a SchemaSet>,
pub namespaces: NamespaceContextSnapshot,
pub default_element_ns: Option<NameId>,
pub default_function_ns: Option<&'static str>,
pub implicit_timezone: Option<TimezoneOffset>,
pub base_uri: Option<String>,
pub mode: XPathMode,
pub trace_enabled: bool,
/* private fields */
}Expand description
XPath 2.0 static context for expression binding and evaluation.
The static context provides information needed during expression compilation and evaluation:
- Namespace prefix resolution
- Function registry access
- Default namespaces
- Schema type information
Fields§
§names: &'a NameTableName table for string interning
schema_set: Option<&'a SchemaSet>Schema set for type information
namespaces: NamespaceContextSnapshotNamespace bindings for prefix resolution
default_element_ns: Option<NameId>Default namespace for unprefixed element names
default_function_ns: Option<&'static str>Default namespace for unprefixed function names (fn: namespace)
implicit_timezone: Option<TimezoneOffset>Implicit timezone
base_uri: Option<String>Base URI for relative URI resolution
mode: XPathModeXPath language mode (1.0 or 2.0)
trace_enabled: boolEnable fn:trace() output to stderr (disabled by default)
Implementations§
Source§impl<'a> XPathContext<'a>
impl<'a> XPathContext<'a>
Sourcepub fn new(names: &'a NameTable) -> Self
pub fn new(names: &'a NameTable) -> Self
Create a new static context with the given name table.
Sourcepub fn with_schema_set(self, schema_set: &'a SchemaSet) -> Self
pub fn with_schema_set(self, schema_set: &'a SchemaSet) -> Self
Set the schema set
Sourcepub fn with_namespaces(self, namespaces: NamespaceContextSnapshot) -> Self
pub fn with_namespaces(self, namespaces: NamespaceContextSnapshot) -> Self
Set the namespace bindings
Sourcepub fn with_default_element_ns(self, ns: NameId) -> Self
pub fn with_default_element_ns(self, ns: NameId) -> Self
Set the default element namespace
Sourcepub fn with_default_function_ns(self, ns: &'static str) -> Self
pub fn with_default_function_ns(self, ns: &'static str) -> Self
Set the default function namespace
Sourcepub fn with_implicit_timezone(self, tz: TimezoneOffset) -> Self
pub fn with_implicit_timezone(self, tz: TimezoneOffset) -> Self
Set the implicit timezone
Sourcepub fn with_base_uri(self, base_uri: impl Into<String>) -> Self
pub fn with_base_uri(self, base_uri: impl Into<String>) -> Self
Set the base URI
Sourcepub fn with_trace_enabled(self, enabled: bool) -> Self
pub fn with_trace_enabled(self, enabled: bool) -> Self
Enable fn:trace() output to stderr.
Sourcepub fn with_function_catalog(self, catalog: &'a dyn FunctionCatalog) -> Self
pub fn with_function_catalog(self, catalog: &'a dyn FunctionCatalog) -> Self
Set the function catalog for custom function support.
Sourcepub fn function_catalog(&self) -> &dyn FunctionCatalog
pub fn function_catalog(&self) -> &dyn FunctionCatalog
Get the function catalog, using built-in functions as default.
Returns a reference to the configured catalog, or BuiltinCatalog if none set.
Sourcepub fn resolve_prefix(&self, prefix: &str) -> Option<String>
pub fn resolve_prefix(&self, prefix: &str) -> Option<String>
Resolve a prefix to a namespace URI.
Returns the namespace URI for the given prefix, or None if not found.
Sourcepub fn resolve_prefix_id(&self, prefix_id: NameId) -> Option<NameId>
pub fn resolve_prefix_id(&self, prefix_id: NameId) -> Option<NameId>
Resolve a prefix to a namespace URI using NameId.
Sourcepub fn default_function_namespace(&self) -> &str
pub fn default_function_namespace(&self) -> &str
Get the default function namespace.
In XPath 1.0 mode, core functions live in no namespace (empty string). In XPath 2.0 mode, the default is the fn: namespace.
Sourcepub fn resolve_name(&self, id: NameId) -> Option<String>
pub fn resolve_name(&self, id: NameId) -> Option<String>
Resolve a name from the name table.
Trait Implementations§
Source§impl<'a> Clone for XPathContext<'a>
impl<'a> Clone for XPathContext<'a>
Source§fn clone(&self) -> XPathContext<'a>
fn clone(&self) -> XPathContext<'a>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more