quick_xml::name

Struct NamespaceEntry

source
struct NamespaceEntry {
    start: usize,
    prefix_len: usize,
    value_len: usize,
    level: i32,
}
Expand description

An entry that contains index into the buffer with namespace bindings.

Defines a mapping from namespace prefix to namespace name. If prefix is empty, defines a default namespace binding that applies to unprefixed element names (unprefixed attribute names do not bind to any namespace and they processing is dependent on the element in which their defined).

Fields§

§start: usize

Index of the namespace in the buffer

§prefix_len: usize

Length of the prefix

  • if greater than zero, then binds this namespace to the slice [start..start + prefix_len] in the buffer.
  • else defines the current default namespace.
§value_len: usize

The length of a namespace name (the URI) of this namespace declaration. Name started just after prefix and extend for value_len bytes.

The XML standard specifies that an empty namespace value ‘removes’ a namespace declaration for the extent of its scope. For prefix declarations that’s not very interesting, but it is vital for default namespace declarations. With xmlns="" you can revert back to the default behaviour of leaving unqualified element names unqualified.

§level: i32

Level of nesting at which this namespace was declared. The declaring element is included, i.e., a declaration on the document root has level = 1. This is used to pop the namespace when the element gets closed.

Implementations§

source§

impl NamespaceEntry

source

fn prefix<'b>(&self, ns_buffer: &'b [u8]) -> Option<Prefix<'b>>

Get the namespace prefix, bound to this namespace declaration, or None, if this declaration is for default namespace (xmlns="...").

source

fn namespace<'ns>(&self, buffer: &'ns [u8]) -> ResolveResult<'ns>

Gets the namespace name (the URI) slice out of namespace buffer

Returns None if namespace for this prefix was explicitly removed from scope, using xmlns[:prefix]=""

Trait Implementations§

source§

impl Clone for NamespaceEntry

source§

fn clone(&self) -> NamespaceEntry

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl Debug for NamespaceEntry

source§

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

Formats the value using the given formatter. 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> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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> 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.