From 88180133216dc6b065b502e1f576405ba0c1c529 Mon Sep 17 00:00:00 2001
From: Tinny Ng <tng@apache.org>
Date: Wed, 23 Jan 2002 21:22:29 +0000
Subject: [PATCH] [Bug 5545 ]  Progressive Parse trashes when encountering "<! 
 ... "

git-svn-id: https://svn.apache.org/repos/asf/xerces/c/trunk@173428 13f79535-47bb-0310-9956-ffa450edef68
---
 src/internal/XMLScanner.cpp | 39 +++++++++++++++++++------------------
 1 file changed, 20 insertions(+), 19 deletions(-)

diff --git a/src/internal/XMLScanner.cpp b/src/internal/XMLScanner.cpp
index 689d50802..132be4432 100644
--- a/src/internal/XMLScanner.cpp
+++ b/src/internal/XMLScanner.cpp
@@ -735,31 +735,32 @@ bool XMLScanner::scanNext(XMLPScanToken& token)
     unsigned int orgReader;
     XMLTokens curToken;
 
-    //
-    //  We have to handle any end of entity exceptions that happen here.
-    //  We could be at the end of X nested entities, each of which will
-    //  generate an end of entity exception as we try to move forward.
-    //
+    bool retVal = true;
 
-    while (true)
+    try
     {
-        try
+        while (true)
         {
-            curToken = senseNextToken(orgReader);
-            break;
-        }
+            //
+            //  We have to handle any end of entity exceptions that happen here.
+            //  We could be at the end of X nested entities, each of which will
+            //  generate an end of entity exception as we try to move forward.
+            //
 
-        catch(const EndOfEntityException& toCatch)
-        {
-            // Send an end of entity reference event
-            if (fDocHandler)
-                fDocHandler->endEntityReference(toCatch.getEntity());
+            try
+            {
+                curToken = senseNextToken(orgReader);
+                break;
+            }
+
+            catch(const EndOfEntityException& toCatch)
+            {
+                // Send an end of entity reference event
+                if (fDocHandler)
+                    fDocHandler->endEntityReference(toCatch.getEntity());
+            }
         }
-    }
 
-    bool retVal = true;
-    try
-    {
         if (curToken == Token_CharData)
         {
             scanCharData(fCDataBuf);
-- 
GitLab