Skip to main content

make

Function make 

Source
pub fn make() -> Tabnas
Expand description

Build an XML parser with the default options.

Reuse the result: building the grammar dominates a parse.

let parser = tabnas_xml::make();
assert_eq!(
    parser.parse("<a><b/></a>")?.to_string(),
    r#"{"name":"a","localName":"a","attributes":{},"children":[{"name":"b","localName":"b","attributes":{},"children":[]}]}"#
);
assert_eq!(parser.parse("<a></b>").unwrap_err().code, "xml_mismatched_tag");