Skip to main content

XPathContext

Struct XPathContext 

Source
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 NameTable

Name table for string interning

§schema_set: Option<&'a SchemaSet>

Schema set for type information

§namespaces: NamespaceContextSnapshot

Namespace 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: XPathMode

XPath language mode (1.0 or 2.0)

§trace_enabled: bool

Enable fn:trace() output to stderr (disabled by default)

Implementations§

Source§

impl<'a> XPathContext<'a>

Source

pub fn new(names: &'a NameTable) -> Self

Create a new static context with the given name table.

Source

pub fn with_schema_set(self, schema_set: &'a SchemaSet) -> Self

Set the schema set

Source

pub fn with_namespaces(self, namespaces: NamespaceContextSnapshot) -> Self

Set the namespace bindings

Source

pub fn with_default_element_ns(self, ns: NameId) -> Self

Set the default element namespace

Source

pub fn with_default_function_ns(self, ns: &'static str) -> Self

Set the default function namespace

Source

pub fn with_implicit_timezone(self, tz: TimezoneOffset) -> Self

Set the implicit timezone

Source

pub fn with_base_uri(self, base_uri: impl Into<String>) -> Self

Set the base URI

Source

pub fn with_mode(self, mode: XPathMode) -> Self

Set the XPath language mode.

Source

pub fn with_trace_enabled(self, enabled: bool) -> Self

Enable fn:trace() output to stderr.

Source

pub fn mode(&self) -> XPathMode

Get the XPath language mode.

Source

pub fn with_function_catalog(self, catalog: &'a dyn FunctionCatalog) -> Self

Set the function catalog for custom function support.

Source

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.

Source

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.

Source

pub fn resolve_prefix_id(&self, prefix_id: NameId) -> Option<NameId>

Resolve a prefix to a namespace URI using NameId.

Source

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.

Source

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>

Source§

fn clone(&self) -> XPathContext<'a>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Debug for XPathContext<'a>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for XPathContext<'a>

§

impl<'a> !Send for XPathContext<'a>

§

impl<'a> !Sync for XPathContext<'a>

§

impl<'a> !UnwindSafe for XPathContext<'a>

§

impl<'a> Freeze for XPathContext<'a>

§

impl<'a> Unpin for XPathContext<'a>

§

impl<'a> UnsafeUnpin for XPathContext<'a>

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.