|
From: SourceForge.net <no...@so...> - 2005-05-03 21:50:24
|
Bugs item #664479, was opened at 2003-01-08 10:50 Message generated for change (Comment added) made by patrickh You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=467781&aid=664479&group_id=52718 Category: None Group: None >Status: Closed >Resolution: Fixed Priority: 5 Submitted By: Nobody/Anonymous (nobody) >Assigned to: Patrick Hartling (patrickh) Summary: There is a bug when parsing comments Initial Comment: The following went through ok. <!-- Success comment --> But this one failed <!-- Failed comment--> If there is a trailing space before closing tag everything works ok, if not it fails. Serge Gut gu...@ga... ---------------------------------------------------------------------- >Comment By: Patrick Hartling (patrickh) Date: 2005-05-03 16:50 Message: Logged In: YES user_id=49856 The patch has been committed as Revision 1.29 and Revision 1.26.2.1 of cppdom/cppdom/xmlparser.cpp. Sorry it took so long. :( ---------------------------------------------------------------------- Comment By: Andy Friesen (the_speed_bump) Date: 2003-02-20 18:38 Message: Logged In: YES user_id=328934 This patch fixes it. It also fixes <!----> comments, and throws an exception if end-of-stream is hit before closing the comment block. --- copy after this --- Index: cppdom/xmlparser.cpp =================================================================== RCS file: /cvsroot/xml-cppdom/cppdom/cppdom/xmlparser.cpp,v retrieving revision 1.24 diff -u -r1.24 xmlparser.cpp --- cppdom/xmlparser.cpp 14 Jan 2003 22:29:55 -0000 1.24 +++ cppdom/xmlparser.cpp 21 Feb 2003 00:29:19 -0000 @@ -131,6 +131,9 @@ if (token3.getGeneric().at(0) == '-' && token3.getGeneric().at(1) == '-') { + // needed to correctly handle <!----> + mTokenizer.putBack(XMLToken(token3.getGeneric().substr(2))); + parseComment(context); } else @@ -452,7 +455,13 @@ while (true) { ++mTokenizer; - if (*mTokenizer == "--") + + if (mTokenizer->isEndOfStream()) + throw XMLError(xml_closetag_expected); + + // Needed to handle -->s not preceded by whitespace + const std::string& s = mTokenizer->getGeneric(); + if (s.length() >= 2 && (s.substr(s.length()-2) == "--")) { ++mTokenizer; if (*mTokenizer == '>') ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=467781&aid=664479&group_id=52718 |