aboutsummaryrefslogtreecommitdiff
path: root/aero-dav/src/xml.rs
diff options
context:
space:
mode:
authorQuentin Dufour <quentin@deuxfleurs.fr>2024-03-08 11:34:24 +0100
committerQuentin Dufour <quentin@deuxfleurs.fr>2024-03-08 11:34:24 +0100
commit4d65366ff368cc9ea35115cb7e701bfebb166bc6 (patch)
tree549ed84e4da71c7768b81535f7b564be31da37a1 /aero-dav/src/xml.rs
parentb9f32d720ae5ec60cadeb492af781ade48cd6cbf (diff)
downloadaerogramme-4d65366ff368cc9ea35115cb7e701bfebb166bc6.tar.gz
aerogramme-4d65366ff368cc9ea35115cb7e701bfebb166bc6.zip
Fixed some parsing bugs
Diffstat (limited to 'aero-dav/src/xml.rs')
-rw-r--r--aero-dav/src/xml.rs7
1 files changed, 5 insertions, 2 deletions
diff --git a/aero-dav/src/xml.rs b/aero-dav/src/xml.rs
index 98037ac..f9e04eb 100644
--- a/aero-dav/src/xml.rs
+++ b/aero-dav/src/xml.rs
@@ -79,7 +79,7 @@ impl<T: IRead> Reader<T> {
/// skip a node at current level
/// I would like to make this one private but not ready
pub async fn skip(&mut self) -> Result<Event<'static>, ParsingError> {
- //println!("skipping inside node {:?}", self.parents.last());
+ //println!("skipping inside node {:?} value {:?}", self.parents.last(), self.cur);
match &self.cur {
Event::Start(b) => {
let _span = self.rdr.read_to_end_into_async(b.to_end().name(), &mut self.buf).await?;
@@ -212,8 +212,10 @@ impl<T: IRead> Reader<T> {
}
pub async fn collect<N: Node<N>>(&mut self) -> Result<Vec<N>, ParsingError> {
- self.ensure_parent_has_child()?;
let mut acc = Vec::new();
+ if !self.parent_has_child() {
+ return Ok(acc)
+ }
loop {
match N::qread(self).await {
@@ -230,6 +232,7 @@ impl<T: IRead> Reader<T> {
}
pub async fn open(&mut self, ns: &[u8], key: &str) -> Result<Event<'static>, ParsingError> {
+ //println!("try open tag {:?}", key);
let evt = match self.peek() {
Event::Empty(_) if self.is_tag(ns, key) => self.cur.clone(),
Event::Start(_) if self.is_tag(ns, key) => self.next().await?,