1extern crate quickxml_to_serde;
2use quickxml_to_serde::{xml_string_to_json, Config, NullValue};
3
4fn main() {
5 let xml = r#"<?xml version="1.0" encoding="utf-8"?><a attr1="1"><b><c attr2="001">some text</c></b></a>"#;
6 let conf = Config::new_with_defaults();
7 let json = xml_string_to_json(xml.to_owned(), &conf);
8 println!("{}", json.expect("Malformed XML").to_string());
9
10 let conf = Config::new_with_custom_values(true, "", "txt", NullValue::Null);
11 let json = xml_string_to_json(xml.to_owned(), &conf);
12 println!("{}", json.expect("Malformed XML").to_string());
13}