xso: create library for streamed XML parsing

This library provides the traits to parse structs from XML and
serialise them into XML without having to buffer the document object
model in memory.

The only implementations it provides are for minidom, basically
providing a lower-level interface to `minidom::Element::from_reader` and
`minidom::Element::to_writer`.

This is the first stepping stone into a world where `xmpp_parsers` can
parse the structs directly from XML.
This commit is contained in:
Jonas Schäfer 2024-06-16 10:14:13 +02:00
commit 14a1d66bf8
6 changed files with 497 additions and 0 deletions

View file

@ -427,6 +427,11 @@ impl Element {
Ok(())
}
/// Extracts all children into a collection.
pub fn take_nodes(&mut self) -> Vec<Node> {
self.children.drain(..).collect()
}
/// Returns an iterator over references to every child node of this element.
///
/// # Examples