Struct xmltree::Element [] [src]

pub struct Element {
    pub name: String,
    pub attributes: HashMap<String, String>,
    pub children: Vec<Element>,
    pub text: Option<String>,
}

Represents an XML element.

Fields

name

The name of the Element. Does not include any namespace info

attributes

The Element attributes

children

Children

text

The text data for this element

Methods

impl Element
[src]

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

Derived Implementations

impl Eq for Element
[src]

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 !=.

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 Debug for Element
[src]

fn fmt(&self, __arg_0: &mut Formatter) -> Result

Formats the value using the given formatter.