fn convert_from_xml(node: &roxmltree::Node) -> Value {
    let mut map = IndexMap::new();
    let tag_name = node.tag_name().name();
    map.insert(
        "key".to_string(),
        Rc::new(RefCell::new(Value::String(tag_name.to_string(), None))),
    );
    if node.is_text() {
        let text_opt = node.text();
        match text_opt {
            None => {}
            Some(s) => {
                map.insert(
                    "text".to_string(),
                    Rc::new(RefCell::new(Value::String(s.to_string(), None))),
                );
            }
        }
        return Value::Hash(map);
    }

    let mut attr_map = IndexMap::new();
    for attr in node.attributes() {
        attr_map.insert(
            attr.name().to_string(),
            Rc::new(RefCell::new(Value::String(attr.value().to_string(), None))),
        );
    }
    map.insert(
        "attributes".to_string(),
        Rc::new(RefCell::new(Value::Hash(attr_map))),
    );

    let mut child_nodes = VecDeque::new();
    for child_node in node.children() {
        let child_node_value = convert_from_xml(&child_node);
        child_nodes.push_back(Rc::new(RefCell::new(child_node_value)));
    }
    map.insert("value".to_string(),
               Rc::new(RefCell::new(Value::List(child_nodes))));
    return Value::Hash(map);
}
/// Converts a roxmltree object into a value.
Converts a roxmltree object into a value.
Converts a roxmltree object into a value .
fn convert_from_xml(node: &roxmltree::Node) -> Value {
    let mut map = IndexMap::new();
    let tag_name = node.tag_name().name();
    map.insert(
        "key".to_string(),
        Rc::new(RefCell::new(Value::String(tag_name.to_string(), None))),
    );
    if node.is_text() {
        let text_opt = node.text();
        match text_opt {
            None => {}
            Some(s) => {
                map.insert(
                    "text".to_string(),
                    Rc::new(RefCell::new(Value::String(s.to_string(), None))),
                );
            }
        }
        return Value::Hash(map);
    }
    let mut attr_map = IndexMap::new();
    for attr in node.attributes() {
        attr_map.insert(
            attr.name().to_string(),
            Rc::new(RefCell::new(Value::String(attr.value().to_string(), None))),
        );
    }
    map.insert(
        "attributes".to_string(),
        Rc::new(RefCell::new(Value::Hash(attr_map))),
    );
    let mut child_nodes = VecDeque::new();
    for child_node in node.children() {
        let child_node_value = convert_from_xml(&child_node);
        child_nodes.push_back(Rc::new(RefCell::new(child_node_value)));
    }
    map.insert("value".to_string(),
               Rc::new(RefCell::new(Value::List(child_nodes))));
    return Value::Hash(map);
}
fn convert_from_xml ( node : & roxmltree :: Node ) -> Value { let mut map = IndexMap :: new ( ) ; let tag_name = node . tag_name ( ) . name ( ) ; map . insert ( " " . to_string ( ) , Rc :: new ( RefCell :: new ( Value :: String ( tag_name . to_string ( ) , None ) ) ) , ) ; if node . is_text ( ) { let text_opt = node . text ( ) ; match text_opt { None => { } Some ( s ) => { map . insert ( " " . to_string ( ) , Rc :: new ( RefCell :: new ( Value :: String ( s . to_string ( ) , None ) ) ) , ) ; } } return Value :: Hash ( map ) ; } let mut attr_map = IndexMap :: new ( ) ; for attr in node . attributes ( ) { attr_map . insert ( attr . name ( ) . to_string ( ) , Rc :: new ( RefCell :: new ( Value :: String ( attr . value ( ) . to_string ( ) , None ) ) ) , ) ; } map . insert ( " " . to_string ( ) , Rc :: new ( RefCell :: new ( Value :: Hash ( attr_map ) ) ) , ) ; let mut child_nodes = VecDeque :: new ( ) ; for child_node in node . children ( ) { let child_node_value = convert_from_xml ( & child_node ) ; child_nodes . push_back ( Rc :: new ( RefCell :: new ( child_node_value ) ) ) ; } map . insert ( " " . to_string ( ) , Rc :: new ( RefCell :: new ( Value :: List ( child_nodes ) ) ) ) ; return Value :: Hash ( map ) ; }
Converts a roxmltree object into a value.
Converts a roxmltree object into a value .
node
&roxmltree::Node