xml/reader/parser/
inside_cdata.rs1use reader::events::XmlEvent;
2use reader::lexer::Token;
3
4use super::{Result, PullParser, State};
5
6impl PullParser {
7 pub fn inside_cdata(&mut self, t: Token) -> Option<Result> {
8 match t {
9 Token::CDataEnd => {
10 self.lexer.enable_errors();
11 let event = if self.config.cdata_to_characters {
12 None
13 } else {
14 let data = self.take_buf();
15 Some(Ok(XmlEvent::CData(data)))
16 };
17 self.into_state(State::OutsideTag, event)
18 }
19
20 Token::Whitespace(_) => {
21 t.push_to_string(&mut self.buf);
22 None
23 }
24
25 _ => {
26 self.inside_whitespace = false;
27 t.push_to_string(&mut self.buf);
28 None
29 }
30 }
31 }
32}