parse_everything/
parse_everything.rs

1//!This example demonstrates how to parse an entire XML file into a `Document` .
2//!The `Document` is a representation of the XML document as a tree of Elements
3//!Notice that it's a bit unweildy when displayed, but it's a good way to see the entire structure of the XML document.
4//!See the `parse_first_matching_element.rs` example for a more detailed example of how to parse individual elements.
5//!
6//! Note: Beware that this consume the entire file into memory, so it's not recommended for large files.
7
8use std::fs::File;
9
10use nom_xml::{config::Config, io::parse_entire_file};
11
12fn main() -> Result<(), Box<dyn std::error::Error>> {
13    let mut file = File::open("examples/TheExpanseSeries.xml")?;
14    let doc = parse_entire_file(&mut file, &Config::default())?;
15
16    println!("{doc:?}");
17    Ok(())
18}