EventReader never return Result::Err after document end. It returns Ok(EndDocument) over and over instead. It does not depend on the flag ignore_end_of_stream.
So, next code stuck in an endless loop:
use std::io::{BufReader, Cursor};
use xml::{EventReader, ParserConfig};
fn main() {
let content = "<a></a>";
let reader = BufReader::new(Cursor::new(content));
let mut parser = EventReader::new_with_config(reader, ParserConfig::new().ignore_end_of_stream(true /* or false */) );
loop {
if let Err(_) = parser.next() {
break;
}
}
}
EventReader never return Result::Err after document end. It returns
Ok(EndDocument)
over and over instead. It does not depend on the flagignore_end_of_stream
.So, next code stuck in an endless loop: