[libxml2] More fixups on the push parser behaviour



commit 5353bbf7dda0a01462109337c5fa34859d3e6d0b
Author: Daniel Veillard <veillard redhat com>
Date:   Fri Aug 3 12:03:31 2012 +0800

    More fixups on the push parser behaviour

 parser.c |   19 +++++++++++++++++--
 1 files changed, 17 insertions(+), 2 deletions(-)
---
diff --git a/parser.c b/parser.c
index a95dd1a..3d44dc1 100644
--- a/parser.c
+++ b/parser.c
@@ -11583,13 +11583,17 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
 		    (ctxt->input->cur[7] == 'P') &&
 		    (ctxt->input->cur[8] == 'E')) {
 		    if ((!terminate) &&
-		        (xmlParseLookupSequence(ctxt, '>', 0, 0) < 0))
+		        (xmlParseLookupSequence(ctxt, '>', 0, 0) < 0)) {
+                        ctxt->progressive = XML_PARSER_DTD;
 			goto done;
+                    }
 #ifdef DEBUG_PUSH
 		    xmlGenericError(xmlGenericErrorContext,
 			    "PP: Parsing internal subset\n");
 #endif
 		    ctxt->inSubset = 1;
+                    ctxt->progressive = 1;
+		    ctxt->checkIndex = 0;
 		    xmlParseDocTypeDecl(ctxt);
 		    if (RAW == '[') {
 			ctxt->instate = XML_PARSER_DTD;
@@ -11979,12 +11983,23 @@ xmlParseCheckTransition(xmlParserCtxtPtr ctxt, const char *chunk, int size) {
             return(1);
         return(0);
     }
+    if (ctxt->instate == XML_PARSER_CDATA_SECTION) {
+        if (memchr(chunk, '>', size) != NULL)
+            return(1);
+        return(0);
+    }
     if (ctxt->progressive == XML_PARSER_PI) {
         if (memchr(chunk, '>', size) != NULL)
             return(1);
         return(0);
     }
-    if (ctxt->instate == XML_PARSER_DTD) {
+    if (ctxt->instate == XML_PARSER_END_TAG) {
+        if (memchr(chunk, '>', size) != NULL)
+            return(1);
+        return(0);
+    }
+    if ((ctxt->progressive == XML_PARSER_DTD) ||
+        (ctxt->instate == XML_PARSER_DTD)) {
         if (memchr(chunk, ']', size) != NULL)
             return(1);
         return(0);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]