diff options
Diffstat (limited to 'src/element.rs')
-rw-r--r-- | src/element.rs | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/element.rs b/src/element.rs index 98a3315..1f78419 100644 --- a/src/element.rs +++ b/src/element.rs @@ -8,6 +8,8 @@ use std::{ str::FromStr, }; +use tracing::debug; + use crate::{ error::{DeserializeError, Error}, xml::{self, parsers_complete::Parser, Attribute}, @@ -322,17 +324,28 @@ impl Element { let mut children = Vec::new(); loop { let child = self.content.front(); + debug!("child: {:?}", child); if let Some(child) = child { match child { Content::Element(element) => { if let Ok(child) = <T as FromElement>::from_element(element.clone()) { + debug!("parsed child"); children.push(child); self.content.pop_front(); + } else { + debug!("failed to parse child"); + return Ok(children); } } Content::Text(_) => return Ok(children), - Content::PI => {} - Content::Comment(_) => {} + Content::PI => { + self.content.pop_front(); + continue; + } + Content::Comment(_) => { + self.content.pop_front(); + continue; + } } } else { return Ok(children); |