tng         2003/02/04 13:21:20

  Modified:    c/src/xercesc/internal DGXMLScanner.cpp
  Log:
  Performance: check AllCharData charopts once instead for every nextCh in the loop.
  
  Revision  Changes    Path
  1.6       +19 -20    xml-xerces/c/src/xercesc/internal/DGXMLScanner.cpp
  
  Index: DGXMLScanner.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/internal/DGXMLScanner.cpp,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- DGXMLScanner.cpp  6 Jan 2003 19:44:57 -0000       1.5
  +++ DGXMLScanner.cpp  4 Feb 2003 21:21:19 -0000       1.6
  @@ -2544,6 +2544,11 @@
       //  characters specially here.
       bool            emittedError = false;
       bool     gotLeadingSurrogate = false;
  +
  +    // Get the character data opts for the current element
  +    const ElemStack::StackElem* topElem = fElemStack.topElement();
  +    XMLElementDecl::CharDataOpts charOpts =  
topElem->fThisElement->getCharDataOpts();
  +
       while (true)
       {
           const XMLCh nextCh = fReaderMgr.getNextChar();
  @@ -2560,13 +2565,8 @@
               // This document is standalone; this ignorable CDATA whitespace is 
forbidden.
               // XML 1.0, Section 2.9
               // And see if the current element is a 'Children' style content model
  -            const ElemStack::StackElem* topElem = fElemStack.topElement();
  -
               if (topElem->fThisElement->isExternal()) {
   
  -                // Get the character data opts for the current element
  -                XMLElementDecl::CharDataOpts charOpts =  
topElem->fThisElement->getCharDataOpts();
  -
                   if (charOpts == XMLElementDecl::SpacesOk) // Element Content
                   {
                       // Error - standalone should have a value of "no" as whitespace 
detected in an
  @@ -2580,6 +2580,19 @@
           //  sequence.
           if (nextCh == chCloseSquare && fReaderMgr.skippedString(CDataClose))
           {
  +            //  make sure we were not expecting a trailing surrogate.
  +            if (gotLeadingSurrogate)
  +                emitError(XMLErrs::Expected2ndSurrogateChar);
  +
  +            if (fValidate) {
  +
  +                if (charOpts != XMLElementDecl::AllCharData)
  +                {
  +                    // They definitely cannot handle any type of char data
  +                    fValidator->emitError(XMLValid::NoCharDataInCM);
  +                }
  +            }
  +
               // If we have a doc handler, call it
               if (fDocHandler)
               {
  @@ -2645,20 +2658,6 @@
                       }
                   }
                   gotLeadingSurrogate = false;
  -            }
  -        }
  -
  -        if (fValidate) {
  -            // And see if the current element is a 'Children' style content model
  -            const ElemStack::StackElem* topElem = fElemStack.topElement();
  -
  -            // Get the character data opts for the current element
  -            XMLElementDecl::CharDataOpts charOpts = 
topElem->fThisElement->getCharDataOpts();
  -
  -            if (charOpts != XMLElementDecl::AllCharData)
  -            {
  -                // They definitely cannot handle any type of char data
  -                fValidator->emitError(XMLValid::NoCharDataInCM);
               }
           }
   
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to