Skip to content

Commit

Permalink
Fix netvl#227
Browse files Browse the repository at this point in the history
  • Loading branch information
kornelski committed Jul 19, 2023
1 parent 8defd10 commit a609050
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/reader/parser/inside_cdata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ impl PullParser {
match t {
Token::CDataEnd => {
let event = if self.config.c.cdata_to_characters {
// start called push_pos, but there will be no event to pop it
if self.buf.is_empty() {
self.next_pos();
}
None
} else {
let data = self.take_buf();
Expand Down
21 changes: 21 additions & 0 deletions tests/event_reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,27 @@ fn issue_204() {
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<").into_iter().for_each(|_| {});
}

#[test]
fn issue_227() {
xml::EventReader::new_with_config(r#"<root>
<item><![CDATA[]]></item>
<item><![CDATA[]]></item>
<item><![CDATA[]]></item>
<item><![CDATA[]]></item>
<item><![CDATA[]]></item>
<item><![CDATA[]]></item>
<item><![CDATA[]]></item>
<item><![CDATA[]]></item>
<item><![CDATA[]]></item>
<item><![CDATA[]]></item>
<item><![CDATA[]]></item>
<item><![CDATA[]]></item>
<item><![CDATA[]]></item>
<item><![CDATA[]]></item>
</root>"#.as_bytes(),
ParserConfig::new().cdata_to_characters(true)).into_iter().for_each(|_| {});
}

#[test]
fn sample_1_short() {
test_files(
Expand Down

0 comments on commit a609050

Please sign in to comment.