Struct Element
Source pub struct Element<'a> { }
Expand description
Represents an XML element.
Creates a new instance of Element
with the given name.
§Arguments
name
- The name of the element.
§Example
let element = Element::new("root");
Adds a namespace to the element and returns a modified Element
.
§Arguments
namespace
- The namespace to be added.
§Example
let element = Element::new("root")
.add_namespace(Namespace::new("name", "http://example.com"));
Adds an attribute to the element and returns a modified Element
.
§Arguments
attribute
- The attribute to be added.
§Example
let element = Element::new("root")
.add_attribute(Attribute::new("attr1", "value1"));
Adds a child element to the element and returns a modified Element
.
§Arguments
child
- The child element to be added.
§Example
let child = Element::new("child");
let element = Element::new("root")
.add_child(child);
Formats the element and its content as an XML string.
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.
Converts the given value to a
String
.
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.