You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by an...@locus.apache.org on 2000/09/09 01:14:34 UTC

cvs commit: xml-xerces/c/src/internal XMLScanner2.cpp

andyh       00/09/08 16:14:33

  Modified:    c/src/internal XMLScanner2.cpp
  Log:
  Remove incorrect detection of nested CDATA sections.  The CDATA
  start <![CDATA[  may appear within anothre CDATA, it's just not recognized.
  
  Revision  Changes    Path
  1.17      +16 -46    xml-xerces/c/src/internal/XMLScanner2.cpp
  
  Index: XMLScanner2.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/internal/XMLScanner2.cpp,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- XMLScanner2.cpp	2000/07/25 22:33:05	1.16
  +++ XMLScanner2.cpp	2000/09/08 23:14:32	1.17
  @@ -55,7 +55,7 @@
    */
   
   /*
  - * $Id: XMLScanner2.cpp,v 1.16 2000/07/25 22:33:05 aruna1 Exp $
  + * $Id: XMLScanner2.cpp,v 1.17 2000/09/08 23:14:32 andyh Exp $
    */
   
   
  @@ -1457,7 +1457,6 @@
       //  characters specially here.
       //
       bool            emittedError = false;
  -    unsigned int    nestCount = 0;
       while (true)
       {
           const XMLCh nextCh = fReaderMgr.getNextChar();
  @@ -1480,57 +1479,28 @@
   
           //
           //  If this is a close square bracket it could be our closing
  -        //  sequence. Be sure though to handle nested CDATA sections. They
  -        //  are illegal, but we've already issued the error and just need to
  -        //  be sure not to fall out early.
  +        //  sequence. 
           //
  -        if (nextCh == chCloseSquare)
  +        if (nextCh == chCloseSquare && fReaderMgr.skippedString(CDataClose))
           {
  -            if (fReaderMgr.skippedString(CDataClose))
  -            {
  -                if (nestCount)
  -                {
  -                    // We are nested, so just bump down the counter
  -                    nestCount--;
  -                }
  -                 else
  -                {
  -                    // If we have a doc handler, call it
  -                    if (fDocHandler)
  -                    {
  -                        fDocHandler->docCharacters
  -                        (
  -                            bbCData.getRawBuffer()
  -                            , bbCData.getLen()
  -                            , true
  -                        );
  -                    }
  -
  -                    // And we are done
  -                    break;
  -                }
  -            }
  -        }
  -         else if (nextCh == chOpenAngle)
  -        {
  -            //
  -            //  Watch for nested CDATA sections. We got the '<' character,
  -            //  so now we check for the remainder of the ![CDATA[ sequence.
  -            //  If its there, we bump a counter and issue an error.
  -            //
  -            if (fReaderMgr.skippedString(CDataPrefix))
  +            // If we have a doc handler, call it
  +            if (fDocHandler)
               {
  -                // Bump up the nesting count
  -                nestCount++;
  -
  -                // And issue the nested CDATA error
  -                emitError(XMLErrs::NestedCDATA);
  +                fDocHandler->docCharacters
  +                    (
  +                    bbCData.getRawBuffer()
  +                    , bbCData.getLen()
  +                    , true
  +                    );
               }
  +            
  +            // And we are done
  +            break;
           }
  -
  +        
           //
           //  Make sure its a valid character. But if we've emitted an error
  -        //  already, don't both with the overhead since we've already told
  +        //  already, don't bother with the overhead since we've already told
           //  them about it.
           //
           if (!emittedError)