xso: discard xml:lang implicitly

Because this attribute may occur in random places, it makes no sense
failing on it. We discard it after attribute processing though, so it
can still be captured by structs which are explicitly interested in it.
This commit is contained in:
Jonas Schäfer 2025-04-18 19:42:42 +02:00
commit 31d7bbf622
3 changed files with 27 additions and 1 deletions

View file

@ -139,6 +139,23 @@ fn empty_unexpected_attribute() {
}
}
#[test]
#[cfg_attr(
feature = "disable-validation",
should_panic = "unexpected result: Ok("
)]
fn empty_ignores_xml_lang() {
#[allow(unused_imports)]
use core::{
option::Option::{None, Some},
result::Result::{Err, Ok},
};
match parse_str::<Empty>("<foo xmlns='urn:example:ns1' xml:lang='bar'/>") {
Ok(Empty) => (),
other => panic!("unexpected result: {:?}", other),
}
}
#[test]
#[cfg_attr(
feature = "disable-validation",