Skip to main content

make_with

Function make_with 

Source
pub fn make_with(options: &XmlOptions) -> Tabnas
Expand description

Build an XML parser with caller options: the jsonic grammar, then this plugin, the new Tabnas().use(jsonic).use(Xml, options) of the canonical plugin and the jsonic.Make() plus UseDefaults of Go.

Infallible by design: the grammar documents are fixed literals, so a failure here is a bug in this crate rather than anything a caller did.

let parser = tabnas_xml::make_with(&tabnas_xml::XmlOptions {
    strict_entities: false,
    ..Default::default()
});
assert_eq!(
    parser.parse("<a>&nope;</a>")?.to_string(),
    r#"{"name":"a","localName":"a","attributes":{},"children":["&nope;"]}"#
);