Add support for declaration tokens

This commit is contained in:
Dirkjan Ochtman 2022-11-23 18:54:18 -08:00
parent eb2cfd59f9
commit 53d882e067
1 changed files with 4 additions and 0 deletions

View File

@ -302,6 +302,10 @@ impl<'xml> Iterator for Context<'xml> {
Ok(Token::Text { text }) => {
return Some(Ok(Node::Text(text.as_str())));
}
Ok(Token::Declaration { .. }) => match self.stack.is_empty() {
false => return Some(Err(Error::UnexpectedToken(format!("{:?}", token)))),
true => {}
},
Ok(token) => return Some(Err(Error::UnexpectedToken(format!("{:?}", token)))),
Err(e) => return Some(Err(Error::Parse(e))),
}