From 67ab2ff62bb3a4488efeace734338ba8fe68521b Mon Sep 17 00:00:00 2001 From: Lennart <18233294+lennart-k@users.noreply.github.com> Date: Mon, 23 Dec 2024 11:37:39 +0100 Subject: [PATCH] xml: Unparsed, add fix for empty tags --- crates/xml/src/lib.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/crates/xml/src/lib.rs b/crates/xml/src/lib.rs index b49b57b..afcc83b 100644 --- a/crates/xml/src/lib.rs +++ b/crates/xml/src/lib.rs @@ -45,17 +45,20 @@ impl XmlDeserialize for Unit { } // TODO: actually implement +#[derive(Debug, Clone, PartialEq)] pub struct Unparsed(BytesStart<'static>); impl XmlDeserialize for Unparsed { fn deserialize( reader: &mut quick_xml::NsReader, start: &BytesStart, - _empty: bool, + empty: bool, ) -> Result { // let reader_cloned = NsReader::from_reader(reader.get_ref().to_owned()); - let mut buf = vec![]; - reader.read_to_end_into(start.name(), &mut buf)?; + if !empty { + let mut buf = vec![]; + reader.read_to_end_into(start.name(), &mut buf)?; + } Ok(Self(start.to_owned())) } }