nom-xml 0.3.0

A Rust Crate for parsing XML.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
//! This example demonstrates how to parse the first element that matches the given tag name.

use std::fs::File;

use nom_xml::{io::read_file, Document};

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let mut file = File::open("examples/TheExpanseSeries.xml")?;
    let data = read_file(&mut file)?;
    let (_, doc) = Document::parse_element_by_tag_name(&data, "book", &None)?;
    println!("{doc:?}");
    Ok(())
}