Struct rxml::writer::SimpleNamespaces
source · pub struct SimpleNamespaces { /* private fields */ }
Expand description
Simple namespace tracker.
This is the default namespace tracker used by Encoder::new
. At the
cost of increased output size, it reduces memory footprint by only
tracking unprefixed namespaces. Prefixed namespaces may be declared, but
are forgotten about once the element start is over.
Effectively, when used with an Encoder
, this means that prefixed
namespaces will only ever be used for attributes, and may be re-declared
a lot.
One exception is that prefixed namespaces declared on the root element will actually be made available on all child elements.
Implementations§
source§impl SimpleNamespaces
impl SimpleNamespaces
pub fn new() -> Self
sourcepub fn lookup_prefix(
&self,
prefix: Option<&NcNameStr>
) -> Result<NamespaceName, PrefixError>
pub fn lookup_prefix(
&self,
prefix: Option<&NcNameStr>
) -> Result<NamespaceName, PrefixError>
Look up the namespace URI for a given prefix
Note: This function is implemented as O(n) function because it should rarely, if ever, be necessary to use. Speeding up runtime of this function would increase memory cost at neglegible gain.
The namespace URIs for the xml
and xmlns
prefixes are always
returned, even if not explicitly declared.