from_xml_stream

Function from_xml_stream 

Source
pub fn from_xml_stream<R: Read>(
    reader: R,
    config: &StreamConfig,
) -> Result<XmlStreamingParser<R>, String>
Expand description

Create a streaming XML parser from a reader

Returns an iterator that yields Result<StreamItem, String> as items are parsed. This is memory-efficient for multi-gigabyte XML files.

ยงExamples

use std::fs::File;
use hedl_xml::streaming::{from_xml_stream, StreamConfig};

let file = File::open("data.xml")?;
let config = StreamConfig::default();

let mut count = 0;
for result in from_xml_stream(file, &config)? {
    match result {
        Ok(_item) => count += 1,
        Err(e) => eprintln!("Parse error: {}", e),
    }
}
println!("Processed {} items", count);