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>,
}
Expand description

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

Implementations

Create a new empty element with given name

All other fields are empty

Parses some data into an Element

Writes out this element as the root element in an new XML document

Find a child element with the given name and return a reference to it.

Find a child element with the given name and return a mutable reference to it.

Find a child element with the given name, remove and return it.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.