From 72231d67d89835a87a5974b51a031dec347a63db Mon Sep 17 00:00:00 2001 From: Rahul Jain <rahulj@apache.org> Date: Fri, 5 May 2000 01:44:29 +0000 Subject: [PATCH] Fixed defect in progressive parsing 'parseNext()' reported by Tim Johnston <tim@gntsoftware.com>. Fix provided by Dean Roddey. git-svn-id: https://svn.apache.org/repos/asf/xerces/c/trunk@172090 13f79535-47bb-0310-9956-ffa450edef68 --- src/internal/XMLScanner.cpp | 34 ++++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/src/internal/XMLScanner.cpp b/src/internal/XMLScanner.cpp index 0cf473dd8..1a05c4e3d 100644 --- a/src/internal/XMLScanner.cpp +++ b/src/internal/XMLScanner.cpp @@ -56,6 +56,10 @@ /* * $Log$ + * Revision 1.16 2000/05/05 01:44:29 rahulj + * Fixed defect in progressive parsing 'parseNext()' reported by Tim + * Johnston <tim@gntsoftware.com>. Fix provided by Dean Roddey. + * * Revision 1.15 2000/04/19 00:04:33 roddey * Don't allow spaces before PI target. Bug #42 * @@ -640,13 +644,35 @@ bool XMLScanner::scanNext(XMLPScanToken& token) if (!isLegalToken(token)) ThrowXML(RuntimeException, XMLExcepts::Scan_BadPScanToken); + // Find the next token and remember the reader id + 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. + // + + while (true) + { + 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 { - // Find the next token and remember the reader id - unsigned int orgReader; - const XMLTokens curToken = senseNextToken(orgReader); - if (curToken == Token_CharData) { scanCharData(fCDataBuf); -- GitLab