From a2aadde2766f6d3e00757a2a25da70d7c8819ba9 Mon Sep 17 00:00:00 2001 From: Dirkjan Ochtman Date: Tue, 29 Nov 2022 14:24:19 +0100 Subject: [PATCH] Attributes don't inherit the default namespace --- instant-xml-macros/src/de.rs | 1 + instant-xml/src/de.rs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/instant-xml-macros/src/de.rs b/instant-xml-macros/src/de.rs index 2f23113..d8e1f03 100644 --- a/instant-xml-macros/src/de.rs +++ b/instant-xml-macros/src/de.rs @@ -338,6 +338,7 @@ fn named_field( let field_name = field.ident.as_ref().unwrap(); let field_tag = field_meta.tag; let default_ns = match &field_meta.ns.uri { + None if field_meta.attribute => &None, None => &container_meta.ns.uri, _ => &field_meta.ns.uri, }; diff --git a/instant-xml/src/de.rs b/instant-xml/src/de.rs index b2e647a..3481b79 100644 --- a/instant-xml/src/de.rs +++ b/instant-xml/src/de.rs @@ -156,7 +156,7 @@ impl<'xml> Context<'xml> { Some(ns) => self .lookup(ns) .ok_or_else(|| Error::UnknownPrefix(ns.to_owned()))?, - None => self.default_ns(), + None => "", }, name: attr.local, })