Struct xml::namespace::NamespaceStack
[−]
[src]
pub struct NamespaceStack(pub Vec<Namespace>);
Namespace stack is a sequence of namespaces.
Namespace stack is used to represent cumulative namespace consisting of combined namespaces from nested elements.
Methods
impl NamespaceStack[src]
fn empty() -> NamespaceStack
Returns an empty namespace stack.
fn default() -> NamespaceStack
Returns a namespace stack with default items in it.
Default items are the following:
xml→http://www.w3.org/XML/1998/namespace;xmlns→http://www.w3.org/2000/xmlns/.
fn push_empty(&mut self)
Adds an empty namespace to the top of this stack.
fn pop(&mut self) -> Namespace
Removes a namespace at the top of the stack.
Fails if the stack is empty.
fn peek<'a>(&'a mut self) -> &'a mut Namespace
Returns a namespace at the top of the stack, leaving the stack intact.
Fails if the stack is empty.
fn put(&mut self, prefix: Option<String>, uri: String) -> bool
Puts a mapping into the topmost namespace in this stack.
This method does not override a mapping in the topmost namespace if it is already present, however, it does not depend on other namespaces in the stack, so it is possible to put a mapping which is present in lower namespaces.
Returns a boolean flag indicating whether the topmost namespace already contained the given prefix.
Parameters
prefix--- namespace prefix (Nonemeans default namespace);uri--- namespace URI.
Return value
true if prefix has been inserted successfully; false if the prefix
was already present in the namespace.
fn get<'a>(&'a self, prefix: &Option<String>) -> Option<&'a str>
Performs a search for the given prefix in the whole stack.
This method walks the stack from top to bottom, querying each namespace
in order for the given prefix. If none of the namespaces contains the prefix,
None is returned.
Parameters
prefix--- namespace prefix (Nonemeans default namespace)
fn squash(&self) -> Namespace
Combines this stack of namespaces into a single namespace.
Namespaces are combined in left-to-right order, that is, rightmost namespace elements take priority over leftmost ones.
Trait Implementations
impl PartialEq for NamespaceStack[src]
fn eq(&self, __arg_0: &NamespaceStack) -> bool
This method tests for self and other values to be equal, and is used by ==. Read more
fn ne(&self, __arg_0: &NamespaceStack) -> bool
This method tests for !=.
impl Clone for NamespaceStack[src]
fn clone(&self) -> NamespaceStack
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0
Performs copy-assignment from source. Read more