peiyongz    2004/06/03 08:38:28

  Modified:    c/src/xercesc/internal ReaderMgr.cpp ReaderMgr.hpp
                        XMLReader.cpp XMLReader.hpp XMLScanner.cpp
  Log:
  XML1.1:  The characters #x85 and #x2028 cannot be reliably recognized
  and translated until an entity's encoding declaration (if present) has been
  read. Therefore, it is a fatal error to use them within the XML declaration or
  text declaration.
  
  Revision  Changes    Path
  1.24      +24 -1     xml-xerces/c/src/xercesc/internal/ReaderMgr.cpp
  
  Index: ReaderMgr.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/internal/ReaderMgr.cpp,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- ReaderMgr.cpp     25 May 2004 18:09:51 -0000      1.23
  +++ ReaderMgr.cpp     3 Jun 2004 15:38:27 -0000       1.24
  @@ -310,6 +310,29 @@
       return (tmpFlag || skippedSomething);
   }
   
  +bool ReaderMgr::skipPastSpacesInDecl()
  +{
  +    bool skippedSomething = false;
  +    bool tmpFlag;
  +    while (true)
  +    {
  +        //
  +        //  Skip all the spaces in the current reader. If it returned because
  +        //  it hit a non-space, break out. Else we have to pop another entity
  +        //  and keep going.
  +        //
  +        if (fCurReader->skipSpacesInDecl(tmpFlag))
  +            break;
  +
  +        if (tmpFlag)
  +            skippedSomething = true;
  +
  +        // Try to pop another enitity. If we can't then we are done
  +        if (!popReader())
  +            break;
  +    }
  +    return (tmpFlag || skippedSomething);
  +}
   
   void ReaderMgr::skipQuotedString(const XMLCh quoteCh)
   {
  
  
  
  1.12      +4 -0      xml-xerces/c/src/xercesc/internal/ReaderMgr.hpp
  
  Index: ReaderMgr.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/internal/ReaderMgr.hpp,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- ReaderMgr.hpp     29 Jan 2004 11:46:30 -0000      1.11
  +++ ReaderMgr.hpp     3 Jun 2004 15:38:27 -0000       1.12
  @@ -56,6 +56,12 @@
   
   /*
    * $Log$
  + * Revision 1.12  2004/06/03 15:38:27  peiyongz
  + * XML1.1:  The characters #x85 and #x2028 cannot be reliably recognized
  + * and translated until an entity's encoding declaration (if present) has been
  + * read. Therefore, it is a fatal error to use them within the XML declaration or
  + * text declaration.
  + *
    * Revision 1.11  2004/01/29 11:46:30  cargilld
    * Code cleanup changes to get rid of various compiler diagnostic messages.
    *
  @@ -218,6 +224,7 @@
       bool skipIfQuote(XMLCh& chGotten);
       void skipPastChar(const XMLCh toSkip);
       bool skipPastSpaces();
  +    bool skipPastSpacesInDecl();
       void skipToChar(const XMLCh toSkipTo);
       bool skippedChar(const XMLCh toSkip);
       bool skippedSpace();
  
  
  
  1.20      +102 -1    xml-xerces/c/src/xercesc/internal/XMLReader.cpp
  
  Index: XMLReader.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/internal/XMLReader.cpp,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- XMLReader.cpp     29 Jan 2004 11:46:30 -0000      1.19
  +++ XMLReader.cpp     3 Jun 2004 15:38:27 -0000       1.20
  @@ -924,6 +924,107 @@
       return false;
   }
   
  +/***
  + * XML1.1
  + *
  + * 2.11 End-of-Line Handling
  + *  ...
  + *   The characters #x85 and #x2028 cannot be reliably recognized and translated 
  + *   until an entity's encoding declaration (if present) has been read. 
  + *   Therefore, it is a fatal error to use them within the XML declaration or 
  + *   text declaration. 
  + *
  +***/
  +bool XMLReader::skipSpacesInDecl(bool& skippedSomething)
  +{
  +    // Remember the current line and column
  +    XMLSSize_t    orgLine = fCurLine;
  +    XMLSSize_t    orgCol  = fCurCol;
  +
  +    //  We enter a loop where we skip over spaces until we hit the end of
  +    //  this reader or a non-space value. The return indicates whether we
  +    //  hit the non-space (true) or the end (false).
  +    while (true)
  +    {
  +        // Loop through the current chars in the buffer
  +        while (fCharIndex < fCharsAvail)
  +        {
  +            //  See if its a white space char. If so, then process it. Else
  +            //  we've hit a non-space and need to return.
  +            if (isWhitespace(fCharBuf[fCharIndex]))
  +            {
  +                // Get the current char out of the buffer and eat it
  +                XMLCh curCh = fCharBuf[fCharIndex++];
  +
  +                //  Ok, we've got some whitespace here. So we have to store
  +                //  it. But we have to normalize it and update the line and
  +                //  column info along the way.
  +                if (curCh == chCR)
  +                {
  +                    fCurCol = 1;
  +                    fCurLine++;
  +
  +                    //  If not already internalized, then convert it to an
  +                    //  LF and eat any following LF.
  +                    if (fSource == Source_External)
  +                    {
  +                        if ((fCharIndex < fCharsAvail) || refreshCharBuffer())
  +                        {
  +                            if (fCharBuf[fCharIndex] == chLF
  +                                || ((fCharBuf[fCharIndex] == chNEL) && fNEL))
  +                                fCharIndex++;
  +                        }
  +                    }
  +                }
  +                else if (curCh == chLF)                   
  +                {
  +                    fCurCol = 1;
  +                    fCurLine++;
  +                }
  +                else if (curCh == chNEL || curCh == chLineSeparator)
  +                {
  +                    if (fXMLVersion == XMLVersion::XMLV1_1)
  +                    {
  +                        ThrowXMLwithMemMgr1
  +                        (
  +                            TranscodingException
  +                          , XMLExcepts::Reader_NelLsepinDecl
  +                          , fSystemId
  +                          , fMemoryManager
  +                        );
  +                    }
  +                    else //XMLVersion::XMLV1_0
  +                    {
  +                        if (fNEL)
  +                        {
  +                            fCurCol = 1;
  +                            fCurLine++;
  +                        }
  +                    }
  +                }
  +                else
  +                {
  +                    fCurCol++;
  +                }
  +            }
  +            else
  +            {
  +                skippedSomething = (orgLine != fCurLine) || (orgCol != fCurCol);
  +                return true;
  +            }
  +        }
  +
  +        //  We've eaten up the current buffer, so lets try to reload it. If
  +        //  we don't get anything new, then break out. If we do, then we go
  +        //  back to the top to keep getting spaces.
  +        if (!refreshCharBuffer())
  +            break;
  +    }
  +
  +    // We never hit any non-space and ate up the whole reader
  +    skippedSomething = (orgLine != fCurLine) || (orgCol != fCurCol);
  +    return false;
  +}
   
   bool XMLReader::skippedChar(const XMLCh toSkip)
   {
  
  
  
  1.16      +4 -0      xml-xerces/c/src/xercesc/internal/XMLReader.hpp
  
  Index: XMLReader.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/internal/XMLReader.hpp,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- XMLReader.hpp     29 Jan 2004 11:46:30 -0000      1.15
  +++ XMLReader.hpp     3 Jun 2004 15:38:27 -0000       1.16
  @@ -56,6 +56,12 @@
   
   /*
    * $Log$
  + * Revision 1.16  2004/06/03 15:38:27  peiyongz
  + * XML1.1:  The characters #x85 and #x2028 cannot be reliably recognized
  + * and translated until an entity's encoding declaration (if present) has been
  + * read. Therefore, it is a fatal error to use them within the XML declaration or
  + * text declaration.
  + *
    * Revision 1.15  2004/01/29 11:46:30  cargilld
    * Code cleanup changes to get rid of various compiler diagnostic messages.
    *
  @@ -328,6 +334,7 @@
       bool peekNextChar(XMLCh& chGotten);
       bool skipIfQuote(XMLCh& chGotten);
       bool skipSpaces(bool& skippedSomething);
  +    bool skipSpacesInDecl(bool& skippedSomething);
       bool skippedChar(const XMLCh toSkip);
       bool skippedSpace();
       bool skippedString(const XMLCh* const toSkip);
  
  
  
  1.66      +4 -4      xml-xerces/c/src/xercesc/internal/XMLScanner.cpp
  
  Index: XMLScanner.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/internal/XMLScanner.cpp,v
  retrieving revision 1.65
  retrieving revision 1.66
  diff -u -r1.65 -r1.66
  --- XMLScanner.cpp    26 Apr 2004 21:17:54 -0000      1.65
  +++ XMLScanner.cpp    3 Jun 2004 15:38:27 -0000       1.66
  @@ -1340,7 +1340,7 @@
       while (true)
       {
           // Skip any spaces
  -        const unsigned int spaceCount = fReaderMgr.skipPastSpaces();
  +        const unsigned int spaceCount = fReaderMgr.skipPastSpacesInDecl();
   
           // If we are looking at a question mark, then break out
           if (fReaderMgr.lookingAtChar(chQuestion))
  @@ -2170,10 +2170,10 @@
   //  just makes the calling code cleaner by eating whitespace.
   bool XMLScanner::scanEq()
   {
  -    fReaderMgr.skipPastSpaces();
  +    fReaderMgr.skipPastSpacesInDecl();
       if (fReaderMgr.skippedChar(chEqual))
       {
  -        fReaderMgr.skipPastSpaces();
  +        fReaderMgr.skipPastSpacesInDecl();
           return true;
       }
       return false;
  
  
  

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

Reply via email to