@@ -42,10 +42,12 @@ fn decode_name<'n>(name: QName<'n>, decoder: Decoder) -> Result<Cow<'n, str>, De
4242/// - if it is an [`attribute`] name, put `@` in front of the identifier
4343/// - if it is a namespace binding (`xmlns` or `xmlns:xxx`) put the decoded name
4444/// to the identifier
45+ /// - if it is an attribute in the `xml` namespace, put the decoded name
46+ /// to the identifier
4547/// - put the decoded [`local_name()`] of a name to the identifier
4648///
47- /// The final identifier looks like `[@]local_name`, or `@xmlns`, or `@xmlns:binding`
48- /// (where `[]` means optional element).
49+ /// The final identifier looks like `[@]local_name`, or `@xmlns`, or `@xmlns:binding` or
50+ /// `xml:attribute` (where `[]` means optional element).
4951///
5052/// The deserializer also supports deserializing names as other primitive types:
5153/// - numbers
@@ -89,8 +91,15 @@ impl<'i, 'd> QNameDeserializer<'i, 'd> {
8991 if name. as_namespace_binding ( ) . is_some ( ) {
9092 decoder. decode_into ( name. into_inner ( ) , key_buf) ?;
9193 } else {
92- let local = name. local_name ( ) ;
93- decoder. decode_into ( local. into_inner ( ) , key_buf) ?;
94+ // https://github.com/tafia/quick-xml/issues/841
95+ // we also want to map to the full name for `xml:xxx`, because `xml:xxx` attributes
96+ // can apper only in this literal form, as `xml` prefix cannot be redeclared or unbound
97+ let ( local, prefix_opt) = name. decompose ( ) ;
98+ if prefix_opt. map_or ( false , |prefix| prefix. is_xml ( ) ) {
99+ decoder. decode_into ( & name. into_inner ( ) , key_buf) ?;
100+ } else {
101+ decoder. decode_into ( local. into_inner ( ) , key_buf) ?;
102+ }
94103 } ;
95104
96105 Ok ( Self {
0 commit comments