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
impl NamespaceEntry
sourcefn prefix<'b>(&self, ns_buffer: &'b [u8]) -> Option<Prefix<'b>>
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="..."
).
sourcefn namespace<'ns>(&self, buffer: &'ns [u8]) -> ResolveResult<'ns>
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
impl Clone for NamespaceEntry
source§fn clone(&self) -> NamespaceEntry
fn clone(&self) -> NamespaceEntry
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreAuto Trait Implementations§
impl Freeze for NamespaceEntry
impl RefUnwindSafe for NamespaceEntry
impl Send for NamespaceEntry
impl Sync for NamespaceEntry
impl Unpin for NamespaceEntry
impl UnwindSafe for NamespaceEntry
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)