xml: Unparsed, add fix for empty tags

This commit is contained in:
Lennart
2024-12-23 11:37:39 +01:00
parent 825a65e348
commit 67ab2ff62b

View File

@@ -45,17 +45,20 @@ impl XmlDeserialize for Unit {
} }
// TODO: actually implement // TODO: actually implement
#[derive(Debug, Clone, PartialEq)]
pub struct Unparsed(BytesStart<'static>); pub struct Unparsed(BytesStart<'static>);
impl XmlDeserialize for Unparsed { impl XmlDeserialize for Unparsed {
fn deserialize<R: BufRead>( fn deserialize<R: BufRead>(
reader: &mut quick_xml::NsReader<R>, reader: &mut quick_xml::NsReader<R>,
start: &BytesStart, start: &BytesStart,
_empty: bool, empty: bool,
) -> Result<Self, XmlDeError> { ) -> Result<Self, XmlDeError> {
// let reader_cloned = NsReader::from_reader(reader.get_ref().to_owned()); // let reader_cloned = NsReader::from_reader(reader.get_ref().to_owned());
let mut buf = vec![]; if !empty {
reader.read_to_end_into(start.name(), &mut buf)?; let mut buf = vec![];
reader.read_to_end_into(start.name(), &mut buf)?;
}
Ok(Self(start.to_owned())) Ok(Self(start.to_owned()))
} }
} }