Open
Description
Heyo,
The NsReader::read_to_end
seems to break its ability to resolve namespaces. This makes sense looking at its implementation: It simply delegates to the underlying readers' implementation, without updating its NamespaceResolver:
quick-xml/src/reader/ns_reader.rs
Lines 760 to 764 in 9fb797e
Here's a reproducer:
#[test]
fn repro2() {
const S: &'static str = r#"
<?xml version="1.0" encoding="UTF-8"?>
<oval_definitions xmlns="http://oval.mitre.org/XMLSchema/oval-definitions-5">
<tests>
<xmlfilecontent_test xmlns="http://oval.mitre.org/XMLSchema/oval-definitions-5#independent">
</xmlfilecontent_test>
<xmlfilecontent_test xmlns="http://oval.mitre.org/XMLSchema/oval-definitions-5#independent">
</xmlfilecontent_test>
</tests>
<objects/>
</oval_definitions>"#;
let mut reader = quick_xml::NsReader::from_str(S);
let (ns, ev) = loop {
let (ns, ev) = reader.read_resolved_event().unwrap();
match ev {
quick_xml::events::Event::Start(v) if v.local_name().as_ref() == b"xmlfilecontent_test" => {
reader.read_to_end(v.name()).unwrap();
},
quick_xml::events::Event::Empty(v) if v.local_name().as_ref() == b"objects" => break (ns, v),
_ => (),
}
};
assert_eq!(ns, quick_xml::name::ResolveResult::Bound(quick_xml::name::Namespace(b"http://oval.mitre.org/XMLSchema/oval-definitions-5")));
}