From 8b3c02ee19934f31db446f39c4f82e3f7b8a038a Mon Sep 17 00:00:00 2001 From: bbgan <2893129936@qq.com> Date: Sat, 27 Apr 2024 00:57:01 +0800 Subject: [PATCH] fix parse comment[xml] --- iguana/xml_reader.hpp | 16 ++++++++++++++-- test/test_xml.cpp | 2 ++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/iguana/xml_reader.hpp b/iguana/xml_reader.hpp index d1a71294..15634134 100644 --- a/iguana/xml_reader.hpp +++ b/iguana/xml_reader.hpp @@ -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; @@ -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 { // '>(it, end); ++it; diff --git a/test/test_xml.cpp b/test/test_xml.cpp index cdd6c478..0ec90d88 100644 --- a/test/test_xml.cpp +++ b/test/test_xml.cpp @@ -373,6 +373,8 @@ TEST_CASE("test example cdata") { + + this is a cdata node

]]> )";