Struct xml_builder::XMLElement
source · pub struct XMLElement { /* private fields */ }
Expand description
Structure representing an XML element field.
Implementations§
source§impl XMLElement
impl XMLElement
sourcepub fn new(name: &str) -> Self
pub fn new(name: &str) -> Self
Instantiates a new XMLElement object.
Arguments
name
- A string slice that holds the name of the XML element.
sourcepub fn enable_attributes_sorting(&mut self)
pub fn enable_attributes_sorting(&mut self)
Enables attributes sorting.
sourcepub fn disable_attributes_sorting(&mut self)
pub fn disable_attributes_sorting(&mut self)
Disables attributes sorting.
sourcepub fn add_attribute(&mut self, name: &str, value: &str)
pub fn add_attribute(&mut self, name: &str, value: &str)
Adds the given name/value attribute to the XMLElement.
Arguments
name
- A string slice that holds the name of the attributevalue
- A string slice that holds the value of the attribute
sourcepub fn add_child(&mut self, element: XMLElement) -> Result<()>
pub fn add_child(&mut self, element: XMLElement) -> Result<()>
Adds a new XMLElement child object to the references XMLElement.
Raises XMLError
if trying to add a child to a text XMLElement.
Arguments
element
- A XMLElement object to add as child