Function parse_xml_string

Source
pub fn parse_xml_string(xml: &str) -> Result<Vec<XmlNode>, XmlError>
Expand description

Parses the XML string into an XML tree, returns the root <app></app> node, with the children attached to it.

Since the XML allows multiple root nodes, this function returns a Vec<XmlNode> - which are the “root” nodes, containing all their children recursively.

§Example

assert_eq!(
    parse_xml_string("<app><p /><div id='thing' /></app>").unwrap(),
    vec![XmlNode::new("app").with_children(vec![
        XmlNode::new("p"),
        XmlNode::new("div").with_attribute("id", "thing"),
    ])]
)