Skip to content

Commit

Permalink
Merge pull request #242 from bbbgan/master
Browse files Browse the repository at this point in the history
fix parse comment[xml]
  • Loading branch information
bbbgan authored Apr 26, 2024
2 parents d545d69 + 8b3c02e commit 5d848f9
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
16 changes: 14 additions & 2 deletions iguana/xml_reader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,10 @@ IGUANA_INLINE auto skip_till_key(T &value, It &&it, It &&end) {
else if (*it == '?')
IGUANA_UNLIKELY {
// <? ... ?>
skip_till<'>'>(it, end);
while (*(it - 1) != '?') {
++it;
skip_till<'>'>(it, end);
}
++it;
skip_sapces_and_newline(it, end);
continue;
Expand Down Expand Up @@ -275,8 +278,17 @@ IGUANA_INLINE auto skip_till_key(T &value, It &&it, It &&end) {
continue;
}
}
else {
else if (*it == '-') {
// <!-- -->
while (*(it - 1) != '-' || *(it - 2) != '-') {
++it;
skip_till<'>'>(it, end);
}
++it;
skip_sapces_and_newline(it, end);
continue;
}
else {
// <!D
skip_till<'>'>(it, end);
++it;
Expand Down
2 changes: 2 additions & 0 deletions test/test_xml.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,8 @@ TEST_CASE("test example cdata") {
</description>
<!DOCTYPE test node>
<?myapp instruction?>
<!-- <price>3.25</price> -->
<!-- <price a="b"/> -->
<![CDATA[<p>this is a cdata node</p>]]>
</node_t>
)";
Expand Down

0 comments on commit 5d848f9

Please sign in to comment.