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
sourceimpl Element
impl Element
sourcepub fn new(name: &str) -> Element
pub fn new(name: &str) -> Element
Create a new empty element with given name
All other fields are empty
sourcepub fn write<W: Write>(&self, w: W)
pub fn write<W: Write>(&self, w: W)
Writes out this element as the root element in an new XML document
sourcepub fn get_child<K>(&self, k: K) -> Option<&Element> where
String: PartialEq<K>,
pub 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.
Trait Implementations
impl Eq for Element
impl StructuralEq for Element
impl StructuralPartialEq for Element
Auto Trait Implementations
impl RefUnwindSafe for Element
impl Send for Element
impl Sync for Element
impl Unpin for Element
impl UnwindSafe for Element
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more