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

@ -396,7 +396,11 @@ impl Compound {
}
}
let mut discard_attr = TokenStream::default();
// We always implicitly discard the `xml:lang` attribute. Its
// processing is handled using the `#[xml(language)]` meta.
let mut discard_attr = quote! {
let _ = #attrs.remove(::xso::exports::rxml::Namespace::xml(), "lang");
};
for (xml_namespace, xml_name) in self.discard_attr.iter() {
let xml_namespace = match xml_namespace {
Some(v) => v.to_token_stream(),