pub fn program_from_xml(xml: &str) -> Program {
    let mut program = Program::new();

    let package: Package = parser::parse(xml).expect("Failed to parse XML!");
    let document: Document = package.as_document();

    let xml_element = get_xml_element(document).expect("Failed to find XML element!");

    for child in xml_element.children().iter() {
        if let &ChildOfElement::Element(el) = child {
            let element_name = el.name().local_part();
            match element_name {
                "block" => {
                    program.groups.push(StatementBody::new(Some(el)));
                },
                // TODO: handle `variables`
                _ => {}
            }
        }
    }

    program
}
// Utilities for creating Blockly data structures
Utilities for creating Blockly data structures
Utilities for creating Blockly data structures
pub fn program_from_xml(xml: &str) -> Program {
    let mut program = Program::new();
    let package: Package = parser::parse(xml).expect("Failed to parse XML!");
    let document: Document = package.as_document();
    let xml_element = get_xml_element(document).expect("Failed to find XML element!");
    for child in xml_element.children().iter() {
        if let &ChildOfElement::Element(el) = child {
            let element_name = el.name().local_part();
            match element_name {
                "block" => {
                    program.groups.push(StatementBody::new(Some(el)));
                },
                // TODO: handle `variables`
                _ => {}
            }
        }
    }
    program
}
pub fn program_from_xml ( xml : & str ) -> Program { let mut program = Program :: new ( ) ; let package : Package = parser :: parse ( xml ) . expect ( " " ) ; let document : Document = package . as_document ( ) ; let xml_element = get_xml_element ( document ) . expect ( " " ) ; for child in xml_element . children ( ) . iter ( ) { if let & ChildOfElement :: Element ( el ) = child { let element_name = el . name ( ) . local_part ( ) ; match element_name { " " => { program . groups . push ( StatementBody :: new ( Some ( el ) ) ) ; } , // TODO: handle `variables` _ => { } } } } program }
Utilities for creating Blockly data structures
Utilities for creating Blockly data structures
xml
&str
xml
&str