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 more