pub fn xml_to_json_from_slice<W: Write>(
input: &[u8],
out: W,
) -> Result<(), XmlToJsonError>Expand description
Convert XML to JSON from an in-memory byte slice.
Use this instead of xml_to_json when the whole document is already in memory:
events borrow directly from the input, avoiding the copy of every event into an
intermediate buffer that the reader-based APIs must perform.
§Example Usage
use quick_xml_to_json::xml_to_json_from_slice;
let xml = r#"<root><child>Value</child></root>"#;
let mut output = Vec::new();
assert!(xml_to_json_from_slice(xml.as_bytes(), &mut output).is_ok());§Errors
This may error when:
- reading XML
- encountering a malformed character reference (e.g.
&#xZZ;) - writing to the output