Skip to main content

NamespaceContext

Struct NamespaceContext 

Source
pub struct NamespaceContext { /* private fields */ }
Expand description

Tracks namespace bindings during parsing.

Implementations§

Source§

impl NamespaceContext

Source

pub fn new() -> Self

Creates a new namespace context with XML namespace pre-bound.

Source

pub fn push_scope(&mut self)

Pushes a new scope for entering an element.

Source

pub fn pop_scope(&mut self)

Pops the current scope when leaving an element.

Source

pub fn bind(&mut self, prefix: &str, uri: &str)

Binds a prefix to a URI in the current scope.

Source

pub fn resolve(&self, prefix: &str) -> Option<Rc<str>>

Resolves a prefix to its URI, searching from innermost scope.

Source

pub fn default_namespace(&self) -> Option<Rc<str>>

Returns the default namespace (empty prefix binding).

Source

pub fn intern_uri(&mut self, uri: &str) -> Rc<str>

Interns a URI string for memory efficiency.

Trait Implementations§

Source§

impl Default for NamespaceContext

Source§

fn default() -> Self

Returns the “default value” for a type. 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> 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> Same for T

Source§

type Output = T

Should always be Self
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.