Struct xmltree::Element
[−]
[src]
pub struct Element { pub prefix: Option<String>, pub namespace: Option<String>, pub namespaces: Option<Namespace>, pub name: String, pub attributes: HashMap<String, String>, pub children: Vec<Element>, pub text: Option<String>, }
Represents an XML element.
Fields
prefix: Option<String>
This elements prefix, if any
namespace: Option<String>
This elements namespace, if any
namespaces: Option<Namespace>
The full list of namespaces, if any
The Namespace
type is exported from the xml-rs
crate.
name: String
The name of the Element. Does not include any namespace info
attributes: HashMap<String, String>
The Element attributes
children: Vec<Element>
Children
text: Option<String>
The text data for this element
Methods
impl Element
[src]
fn new(name: &str) -> Element
Create a new empty element with given name
All other fields are empty
fn parse<R: Read>(r: R) -> Result<Element, ParseError>
Parses some data into an Element
fn write<W: Write>(&self, w: W)
Writes out this element as the root element in an new XML document
fn get_child<K>(&self, k: K) -> Option<&Element> where String: PartialEq<K>
Find a child element with the given name and return a reference to it.
fn get_mut_child<'a, K>(&'a mut self, k: K) -> Option<&'a mut Element> where String: PartialEq<K>
Find a child element with the given name and return a mutable reference to it.
fn take_child<'a, K>(&'a mut self, k: K) -> Option<Element> where String: PartialEq<K>
Find a child element with the given name, remove and return it.
Trait Implementations
impl Debug for Element
[src]
impl Clone for Element
[src]
fn clone(&self) -> Element
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
impl PartialEq for Element
[src]
fn eq(&self, __arg_0: &Element) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Element) -> bool
This method tests for !=
.