You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by tn...@apache.org on 2001/07/12 20:50:37 UTC

cvs commit: xml-xerces/c/src/util XMLUni.cpp XMLUni.hpp

tng         01/07/12 11:50:36

  Modified:    c/src/internal ReaderMgr.hpp XMLReader.cpp XMLReader.hpp
                        XMLScanner.cpp XMLScanner.hpp XMLScanner2.cpp
               c/src/util XMLUni.cpp XMLUni.hpp
  Log:
  Some performance modification regarding standalone check and xml decl check.
  
  Revision  Changes    Path
  1.13      +22 -12    xml-xerces/c/src/internal/ReaderMgr.hpp
  
  Index: ReaderMgr.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/internal/ReaderMgr.hpp,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- ReaderMgr.hpp	2000/09/09 00:18:18	1.12
  +++ ReaderMgr.hpp	2001/07/12 18:50:08	1.13
  @@ -1,37 +1,37 @@
   /*
    * The Apache Software License, Version 1.1
  - * 
  + *
    * Copyright (c) 1999-2000 The Apache Software Foundation.  All rights
    * reserved.
  - * 
  + *
    * Redistribution and use in source and binary forms, with or without
    * modification, are permitted provided that the following conditions
    * are met:
  - * 
  + *
    * 1. Redistributions of source code must retain the above copyright
  - *    notice, this list of conditions and the following disclaimer. 
  - * 
  + *    notice, this list of conditions and the following disclaimer.
  + *
    * 2. Redistributions in binary form must reproduce the above copyright
    *    notice, this list of conditions and the following disclaimer in
    *    the documentation and/or other materials provided with the
    *    distribution.
  - * 
  + *
    * 3. The end-user documentation included with the redistribution,
  - *    if any, must include the following acknowledgment:  
  + *    if any, must include the following acknowledgment:
    *       "This product includes software developed by the
    *        Apache Software Foundation (http://www.apache.org/)."
    *    Alternately, this acknowledgment may appear in the software itself,
    *    if and wherever such third-party acknowledgments normally appear.
  - * 
  + *
    * 4. The names "Xerces" and "Apache Software Foundation" must
    *    not be used to endorse or promote products derived from this
  - *    software without prior written permission. For written 
  + *    software without prior written permission. For written
    *    permission, please contact apache\@apache.org.
  - * 
  + *
    * 5. Products derived from this software may not be called "Apache",
    *    nor may "Apache" appear in their name, without prior written
    *    permission of the Apache Software Foundation.
  - * 
  + *
    * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
    * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
    * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  @@ -45,7 +45,7 @@
    * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    * SUCH DAMAGE.
    * ====================================================================
  - * 
  + *
    * This software consists of voluntary contributions made by many
    * individuals on behalf of the Apache Software Foundation, and was
    * originally based on software copyright (c) 1999, International
  @@ -56,6 +56,9 @@
   
   /*
    * $Log: ReaderMgr.hpp,v $
  + * Revision 1.13  2001/07/12 18:50:08  tng
  + * Some performance modification regarding standalone check and xml decl check.
  + *
    * Revision 1.12  2000/09/09 00:18:18  andyh
    * Reordered member variables in ThrowEOEJanitor.  Patch submitted
    * by Kirk Wylie.
  @@ -187,6 +190,7 @@
       void skipQuotedString(const XMLCh quoteCh);
       XMLCh skipUntilIn(const XMLCh* const listToSkip);
       XMLCh skipUntilInOrWS(const XMLCh* const listToSkip);
  +    bool peekString(const XMLCh* const toPeek);
   
   
       // -----------------------------------------------------------------------
  @@ -403,6 +407,11 @@
           if ((nextCh == toSkipPast) || !nextCh)
               break;
       }
  +}
  +
  +inline bool ReaderMgr::peekString(const XMLCh* const toPeek)
  +{
  +    return fCurReader->peekString(toPeek);
   }
   
   inline void ReaderMgr::setEntityHandler(XMLEntityHandler* const newHandler)
  
  
  
  1.27      +45 -1     xml-xerces/c/src/internal/XMLReader.cpp
  
  Index: XMLReader.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/internal/XMLReader.cpp,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- XMLReader.cpp	2001/05/11 13:26:17	1.26
  +++ XMLReader.cpp	2001/07/12 18:50:10	1.27
  @@ -55,7 +55,7 @@
    */
   
   /*
  - * $Id: XMLReader.cpp,v 1.26 2001/05/11 13:26:17 tng Exp $
  + * $Id: XMLReader.cpp,v 1.27 2001/07/12 18:50:10 tng Exp $
    */
   
   // ---------------------------------------------------------------------------
  @@ -1132,6 +1132,50 @@
       //  source len to it.
       //
       fCharIndex += srcLen;
  +
  +    return true;
  +}
  +
  +//
  +// This is just to peek if the next coming buffer
  +// matches the string toPeek.
  +// Similar to skippedString, but just the fCharIndex and fCurCol are not updated
  +//
  +bool XMLReader::peekString(const XMLCh* const toPeek)
  +{
  +    // Get the length of the string to skip
  +    const unsigned int srcLen = XMLString::stringLen(toPeek);
  +
  +    //
  +    //  See if the current reader has enough chars to test against this
  +    //  string. If not, then ask it to reload its buffer. If that does not
  +    //  get us enough, then it cannot match.
  +    //
  +    //  NOTE: This works because strings never have to cross a reader! And
  +    //  a string to skip will never have a new line in it, so we will never
  +    //  miss adjusting the current line.
  +    //
  +    unsigned int charsLeft = charsLeftInBuffer();
  +    while (charsLeft < srcLen)
  +    {
  +         refreshCharBuffer();
  +         unsigned int t = charsLeftInBuffer();
  +         if (t == charsLeft)   // if the refreshCharBuf() did not add anything new
  +             return false;     //   give up and return.
  +         charsLeft = t;
  +	}
  +
  +
  +
  +
  +    //
  +    //  Ok, now we now that the current reader has enough chars in its
  +    //  buffer and that its index is back at zero. So we can do a quick and
  +    //  dirty comparison straight to its buffer with no requirement to unget
  +    //  if it fails.
  +    //
  +    if (XMLString::compareNString(&fCharBuf[fCharIndex], toPeek, srcLen))
  +        return false;
   
       return true;
   }
  
  
  
  1.17      +4 -0      xml-xerces/c/src/internal/XMLReader.hpp
  
  Index: XMLReader.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/internal/XMLReader.hpp,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- XMLReader.hpp	2001/05/11 13:26:17	1.16
  +++ XMLReader.hpp	2001/07/12 18:50:13	1.17
  @@ -56,6 +56,9 @@
   
   /*
    * $Log: XMLReader.hpp,v $
  + * Revision 1.17  2001/07/12 18:50:13  tng
  + * Some performance modification regarding standalone check and xml decl check.
  + *
    * Revision 1.16  2001/05/11 13:26:17  tng
    * Copyright update.
    *
  @@ -273,6 +276,7 @@
       bool skippedChar(const XMLCh toSkip);
       bool skippedSpace();
       bool skippedString(const XMLCh* const toSkip);
  +    bool peekString(const XMLCh* const toPeek);
   
   
       // -----------------------------------------------------------------------
  
  
  
  1.55      +4 -58     xml-xerces/c/src/internal/XMLScanner.cpp
  
  Index: XMLScanner.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/internal/XMLScanner.cpp,v
  retrieving revision 1.54
  retrieving revision 1.55
  diff -u -r1.54 -r1.55
  --- XMLScanner.cpp	2001/07/10 20:56:12	1.54
  +++ XMLScanner.cpp	2001/07/12 18:50:15	1.55
  @@ -55,7 +55,7 @@
    */
   
   /*
  - * $Id: XMLScanner.cpp,v 1.54 2001/07/10 20:56:12 tng Exp $
  + * $Id: XMLScanner.cpp,v 1.55 2001/07/12 18:50:15 tng Exp $
    */
   
   
  @@ -2377,7 +2377,7 @@
               //  char refs expanded.
               //
               fReaderMgr.skipPastSpaces();
  -            if (!scanAttValue(attDef->getFullName(), fAttValueBuf, attDef->getType()))
  +            if (!scanAttValue(attDef, fAttValueBuf))
               {
                   static const XMLCh tmpList[] =
                   {
  @@ -2512,7 +2512,8 @@
               //  top again.
               //
               emitError(XMLErrs::ExpectedAttrName);
  -            scanAttValue(XMLUni::fgZeroLenString, fAttValueBuf, XMLAttDef::CData);
  +            fReaderMgr.getNextChar();
  +            fReaderMgr.skipQuotedString(nextCh);
               fReaderMgr.skipPastSpaces();
               continue;
           }
  @@ -3419,59 +3420,4 @@
       }
       return uriId;
   }
  -
  -bool XMLScanner::checkXMLDecl(bool startWithAngle) {
  -    //
  -    // [23] XMLDecl     ::= '<?xml' VersionInfo EncodingDecl? SDDecl? S? '?>'
  -    // [24] VersionInfo ::= S 'version' Eq ("'" VersionNum "'" | '"' VersionNum '"')
  -    //
  -    // [3]  S           ::= (#x20 | #x9 | #xD | #xA)+
  -    //
  -
  -    if (startWithAngle) {
  -        if (fReaderMgr.skippedString(XMLUni::fgXMLDeclStringSpace)
  -           || fReaderMgr.skippedString(XMLUni::fgXMLDeclStringHTab)
  -           || fReaderMgr.skippedString(XMLUni::fgXMLDeclStringLF)
  -           || fReaderMgr.skippedString(XMLUni::fgXMLDeclStringCR))
  -        {
  -            return true;
  -        }
  -        else if (fReaderMgr.skippedString(XMLUni::fgXMLDeclStringSpaceU)
  -           || fReaderMgr.skippedString(XMLUni::fgXMLDeclStringHTabU)
  -           || fReaderMgr.skippedString(XMLUni::fgXMLDeclStringLFU)
  -           || fReaderMgr.skippedString(XMLUni::fgXMLDeclStringCRU))
  -        {
  -            //
  -            //  Just in case, check for upper case. If found, issue
  -            //  an error, but keep going.
  -            //
  -            emitError(XMLErrs::XMLDeclMustBeLowerCase);
  -            return true;
  -        }
  -    }
  -    else {
  -        if (fReaderMgr.skippedString(XMLUni::fgXMLStringSpace)
  -           || fReaderMgr.skippedString(XMLUni::fgXMLStringHTab)
  -           || fReaderMgr.skippedString(XMLUni::fgXMLStringLF)
  -           || fReaderMgr.skippedString(XMLUni::fgXMLStringCR))
  -        {
  -            return true;
  -        }
  -        else if (fReaderMgr.skippedString(XMLUni::fgXMLStringSpaceU)
  -           || fReaderMgr.skippedString(XMLUni::fgXMLStringHTabU)
  -           || fReaderMgr.skippedString(XMLUni::fgXMLStringLFU)
  -           || fReaderMgr.skippedString(XMLUni::fgXMLStringCRU))
  -        {
  -            //
  -            //  Just in case, check for upper case. If found, issue
  -            //  an error, but keep going.
  -            //
  -            emitError(XMLErrs::XMLDeclMustBeLowerCase);
  -            return true;
  -        }
  -    }
  -
  -    return false;
  -}
  -
   
  
  
  
  1.26      +68 -3     xml-xerces/c/src/internal/XMLScanner.hpp
  
  Index: XMLScanner.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/internal/XMLScanner.hpp,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- XMLScanner.hpp	2001/07/10 21:09:31	1.25
  +++ XMLScanner.hpp	2001/07/12 18:50:17	1.26
  @@ -56,6 +56,9 @@
   
   /*
    * $Log: XMLScanner.hpp,v $
  + * Revision 1.26  2001/07/12 18:50:17  tng
  + * Some performance modification regarding standalone check and xml decl check.
  + *
    * Revision 1.25  2001/07/10 21:09:31  tng
    * Give proper error messsage when scanning external id.
    *
  @@ -520,9 +523,14 @@
       bool isLegalToken(const XMLPScanToken& toCheck);
       bool normalizeAttValue
       (
  +        const   XMLAttDef* const    attDef
  +        , const XMLCh* const        value
  +        ,       XMLBuffer&          toFill
  +    );
  +    bool normalizeAttRawValue
  +    (
           const   XMLCh* const        attrName
           , const XMLCh* const        value
  -        , const XMLAttDef::AttTypes type
           ,       XMLBuffer&          toFill
       );
   
  @@ -569,9 +577,8 @@
       );
       bool scanAttValue
       (
  -        const   XMLCh* const        attrName
  +        const   XMLAttDef* const    attDef
           ,       XMLBuffer&          toFill
  -        , const XMLAttDef::AttTypes type
       );
       void scanCDSection();
       void scanCharData(XMLBuffer& toToUse);
  @@ -1115,5 +1122,63 @@
           fValScheme = Val_Always;
       else
           fValScheme = Val_Never;
  +}
  +
  +inline bool XMLScanner::checkXMLDecl(bool startWithAngle) {
  +    //
  +    // [23] XMLDecl     ::= '<?xml' VersionInfo EncodingDecl? SDDecl? S? '?>'
  +    // [24] VersionInfo ::= S 'version' Eq ("'" VersionNum "'" | '"' VersionNum '"')
  +    //
  +    // [3]  S           ::= (#x20 | #x9 | #xD | #xA)+
  +    //
  +
  +    if (startWithAngle) {
  +        if (fReaderMgr.peekString(XMLUni::fgXMLDeclString)) {
  +            if (fReaderMgr.skippedString(XMLUni::fgXMLDeclStringSpace)
  +               || fReaderMgr.skippedString(XMLUni::fgXMLDeclStringHTab)
  +               || fReaderMgr.skippedString(XMLUni::fgXMLDeclStringLF)
  +               || fReaderMgr.skippedString(XMLUni::fgXMLDeclStringCR))
  +            {
  +                return true;
  +            }
  +            else if (fReaderMgr.skippedString(XMLUni::fgXMLDeclStringSpaceU)
  +               || fReaderMgr.skippedString(XMLUni::fgXMLDeclStringHTabU)
  +               || fReaderMgr.skippedString(XMLUni::fgXMLDeclStringLFU)
  +               || fReaderMgr.skippedString(XMLUni::fgXMLDeclStringCRU))
  +            {
  +                //
  +                //  Just in case, check for upper case. If found, issue
  +                //  an error, but keep going.
  +                //
  +                emitError(XMLErrs::XMLDeclMustBeLowerCase);
  +                return true;
  +            }
  +        }
  +    }
  +    else {
  +        if (fReaderMgr.peekString(XMLUni::fgXMLString)) {
  +            if (fReaderMgr.skippedString(XMLUni::fgXMLStringSpace)
  +               || fReaderMgr.skippedString(XMLUni::fgXMLStringHTab)
  +               || fReaderMgr.skippedString(XMLUni::fgXMLStringLF)
  +               || fReaderMgr.skippedString(XMLUni::fgXMLStringCR))
  +            {
  +                return true;
  +            }
  +            else if (fReaderMgr.skippedString(XMLUni::fgXMLStringSpaceU)
  +               || fReaderMgr.skippedString(XMLUni::fgXMLStringHTabU)
  +               || fReaderMgr.skippedString(XMLUni::fgXMLStringLFU)
  +               || fReaderMgr.skippedString(XMLUni::fgXMLStringCRU))
  +            {
  +                //
  +                //  Just in case, check for upper case. If found, issue
  +                //  an error, but keep going.
  +                //
  +                emitError(XMLErrs::XMLDeclMustBeLowerCase);
  +                return true;
  +            }
  +        }
  +    }
  +
  +    return false;
   }
   #endif
  
  
  
  1.48      +98 -61    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.47
  retrieving revision 1.48
  diff -u -r1.47 -r1.48
  --- XMLScanner2.cpp	2001/07/10 16:13:05	1.47
  +++ XMLScanner2.cpp	2001/07/12 18:50:18	1.48
  @@ -55,7 +55,7 @@
    */
   
   /*
  - * $Id: XMLScanner2.cpp,v 1.47 2001/07/10 16:13:05 tng Exp $
  + * $Id: XMLScanner2.cpp,v 1.48 2001/07/12 18:50:18 tng Exp $
    */
   
   
  @@ -313,9 +313,8 @@
               //
               normalizeAttValue
               (
  -                curPair->getKey()
  +                attDef
                   , curPair->getValue()
  -                , attDef->getType()
                   , normBuf
               );
   
  @@ -350,11 +349,10 @@
           {
               // Just normalize as CDATA
               attType = XMLAttDef::CData;
  -            normalizeAttValue
  +            normalizeAttRawValue
               (
                   curPair->getKey()
                   , curPair->getValue()
  -                , XMLAttDef::CData
                   , normBuf
               );
           }
  @@ -546,9 +544,8 @@
   //  are legal if escaped only. And some escape chars are not subject to
   //  normalization rules.
   //
  -bool XMLScanner::normalizeAttValue( const   XMLCh* const        attrName
  +bool XMLScanner::normalizeAttValue( const   XMLAttDef* const    attDef
                                       , const XMLCh* const        value
  -                                    , const XMLAttDef::AttTypes type
                                       ,       XMLBuffer&          toFill)
   {
       // A simple state value for a whitespace processing state machine
  @@ -558,6 +555,10 @@
           , InContent
       };
   
  +    // Get the type and name
  +    const XMLAttDef::AttTypes type = attDef->getType();
  +    const XMLCh* const attrName = attDef->getFullName();
  +
       // Assume its going to go fine, and empty the target buffer in preperation
       bool retVal = true;
       toFill.reset();
  @@ -565,13 +566,7 @@
       //
       // Get attribute def - to check to see if it's declared externally or not
       //
  -    bool  added = false;
  -    bool  isAttExternal = false;
  -    const ElemStack::StackElem* topElem = fElemStack.topElement();
  -    if (topElem && topElem->fThisElement) {
  -        const XMLAttDef* attDef = topElem->fThisElement->findAttr(attrName, 0, 0, 0, XMLElementDecl::FailIfNotFound, added);
  -        isAttExternal = (attDef) ? attDef->isExternal() : false;
  -    }
  +    bool  isAttExternal = attDef->isExternal();
   
       //
       //  Loop through the chars of the source value and normalize it according
  @@ -639,18 +634,6 @@
                   }
                    else
                   {
  -                    //
  -                    // Check Validity Constraint for Standalone document declaration
  -                    // XML 1.0, Section 2.9
  -                    //
  -                    if (fStandalone && fValidate && isAttExternal)
  -                    {
  -                         //
  -                         // Can't have a standalone document declaration of "yes" if  attribute
  -                         // values are subject to normalisation
  -                         //
  -                         fValidator->emitError(XMLValid::NoAttNormForStandalone, attrName);
  -                    }
                       srcPtr++;
                       continue;
                   }
  @@ -661,13 +644,13 @@
                   {
                       curState = InWhitespace;
                       srcPtr++;
  -                    if (!firstNonWS || (nextCh != chSpace))
  +                    //
  +                    // Check Validity Constraint for Standalone document declaration
  +                    // XML 1.0, Section 2.9
  +                    //
  +                    if (fStandalone && fValidate && isAttExternal)
                       {
  -                        //
  -                        // Check Validity Constraint for Standalone document declaration
  -                        // XML 1.0, Section 2.9
  -                        //
  -                        if (fStandalone && fValidate && isAttExternal)
  +                        if (!firstNonWS || (nextCh != chSpace) || (fReaderMgr.lookingAtSpace()))
                           {
                                //
                                // Can't have a standalone document declaration of "yes" if  attribute
  @@ -691,6 +674,76 @@
       return retVal;
   }
   
  +//
  +//  This method will just normalize the input value as CDATA without
  +//  any standalone checking.
  +//
  +bool XMLScanner::normalizeAttRawValue( const   XMLCh* const        attrName
  +                                    , const XMLCh* const        value
  +                                    ,       XMLBuffer&          toFill)
  +{
  +    // A simple state value for a whitespace processing state machine
  +    enum States
  +    {
  +        InWhitespace
  +        , InContent
  +    };
  +
  +    // Assume its going to go fine, and empty the target buffer in preperation
  +    bool retVal = true;
  +    toFill.reset();
  +
  +    //
  +    //  Loop through the chars of the source value and normalize it according
  +    //  to the type.
  +    //
  +    States curState = InContent;
  +    bool escaped;
  +    bool firstNonWS = false;
  +    XMLCh nextCh;
  +    const XMLCh* srcPtr = value;
  +    while (*srcPtr)
  +    {
  +        //
  +        //  Get the next character from the source. We have to watch for
  +        //  escaped characters (which are indicated by a 0xFFFF value followed
  +        //  by the char that was escaped.)
  +        //
  +        nextCh = *srcPtr;
  +        escaped = (nextCh == 0xFFFF);
  +        if (escaped)
  +            nextCh = *++srcPtr;
  +
  +        //
  +        //  If its not escaped, then make sure its not a < character, which is
  +        //  not allowed in attribute values.
  +        //
  +        if (!escaped && (*srcPtr == chOpenAngle))
  +        {
  +            emitError(XMLErrs::BracketInAttrValue, attrName);
  +            retVal = false;
  +        }
  +
  +        if (!escaped)
  +        {
  +            //
  +            //  NOTE: Yes this is a little redundant in that a 0x20 is
  +            //  replaced with an 0x20. But its faster to do this (I think)
  +            //  than checking for 9, A, and D separately.
  +            //
  +            if (XMLReader::isWhitespace(nextCh))
  +                nextCh = chSpace;
  +        }
  +
  +        // Add this char to the target buffer
  +        toFill.append(nextCh);
  +
  +        // And move up to the next character in the source
  +        srcPtr++;
  +    }
  +    return retVal;
  +}
  +
   unsigned int
   XMLScanner::resolvePrefix(  const   XMLCh* const        prefix
                               , const ElemStack::MapModes mode)
  @@ -1096,7 +1149,7 @@
       //  care about the return value. An error was issued for the error, which
       //  is all we care about here.
       //
  -    normalizeAttValue(attrName, attrValue, XMLAttDef::CData, normalBuf);
  +    normalizeAttRawValue(attrName, attrValue, normalBuf);
   
       //
       //  Ok, we have to get the unique id for the attribute value, which is the
  @@ -1566,9 +1619,8 @@
   }
   
   
  -bool XMLScanner::scanAttValue(  const   XMLCh* const        attrName
  -                                ,       XMLBuffer&          toFill
  -                                , const XMLAttDef::AttTypes type)
  +bool XMLScanner::scanAttValue(  const   XMLAttDef* const    attDef
  +                                ,       XMLBuffer&          toFill)
   {
       enum States
       {
  @@ -1576,6 +1628,9 @@
           , InContent
       };
   
  +    // Get the type and name
  +    const XMLAttDef::AttTypes type = attDef->getType();
  +    const XMLCh* const attrName = attDef->getFullName();
   
       // Reset the target buffer
       toFill.reset();
  @@ -1594,13 +1649,7 @@
       //
       // Get attribute def - to check to see if it's declared externally or not
       //
  -    bool  added = false;
  -    bool  isAttExternal = false;
  -    const ElemStack::StackElem* topElem = fElemStack.topElement();
  -    if (topElem && topElem->fThisElement) {
  -        const XMLAttDef* attDef = topElem->fThisElement->findAttr(attrName, 0, 0, 0, XMLElementDecl::FailIfNotFound, added);
  -        isAttExternal = (attDef) ? attDef->isExternal() : false;
  -    }
  +    bool  isAttExternal = attDef->isExternal();
   
       //
       //  Loop until we get the attribute value. Note that we use a double
  @@ -1765,18 +1814,6 @@
                       }
                        else
                       {
  -                        //
  -                        // Check Validity Constraint for Standalone document declaration
  -                        // XML 1.0, Section 2.9
  -                        //
  -                        if (fStandalone && fValidate && isAttExternal)
  -                        {
  -                             //
  -                             // Can't have a standalone document declaration of "yes" if  attribute
  -                             // values are subject to normalisation
  -                             //
  -                             fValidator->emitError(XMLValid::NoAttNormForStandalone, attrName);
  -                        }
                           continue;
                       }
                   }
  @@ -1785,13 +1822,13 @@
                       if (XMLReader::isWhitespace(nextCh))
                       {
                           curState = InWhitespace;
  -                        if (!firstNonWS || (nextCh != chSpace))
  +                        //
  +                        // Check Validity Constraint for Standalone document declaration
  +                        // XML 1.0, Section 2.9
  +                        //
  +                        if (fStandalone && fValidate && isAttExternal)
                           {
  -                            //
  -                            // Check Validity Constraint for Standalone document declaration
  -                            // XML 1.0, Section 2.9
  -                            //
  -                            if (fStandalone && fValidate && isAttExternal)
  +                            if (!firstNonWS || (nextCh != chSpace) || (fReaderMgr.lookingAtSpace()))
                               {
                                    //
                                    // Can't have a standalone document declaration of "yes" if  attribute
  
  
  
  1.28      +6 -1      xml-xerces/c/src/util/XMLUni.cpp
  
  Index: XMLUni.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/util/XMLUni.cpp,v
  retrieving revision 1.27
  retrieving revision 1.28
  diff -u -r1.27 -r1.28
  --- XMLUni.cpp	2001/06/22 17:24:02	1.27
  +++ XMLUni.cpp	2001/07/12 18:50:30	1.28
  @@ -55,7 +55,7 @@
    */
   
   /*
  - * $Id: XMLUni.cpp,v 1.27 2001/06/22 17:24:02 tng Exp $
  + * $Id: XMLUni.cpp,v 1.28 2001/07/12 18:50:30 tng Exp $
    */
   
   
  @@ -509,6 +509,11 @@
   };
   
   //<?xml{S}
  +const XMLCh XMLUni::fgXMLDeclString[] =
  +{
  +    chOpenAngle, chQuestion, chLatin_x, chLatin_m, chLatin_l, chNull
  +};
  +
   const XMLCh XMLUni::fgXMLDeclStringSpace[] =
   {
       chOpenAngle, chQuestion, chLatin_x, chLatin_m, chLatin_l, chSpace, chNull
  
  
  
  1.29      +2 -1      xml-xerces/c/src/util/XMLUni.hpp
  
  Index: XMLUni.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/util/XMLUni.hpp,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- XMLUni.hpp	2001/06/22 17:24:02	1.28
  +++ XMLUni.hpp	2001/07/12 18:50:32	1.29
  @@ -55,7 +55,7 @@
    */
   
   /*
  - * $Id: XMLUni.hpp,v 1.28 2001/06/22 17:24:02 tng Exp $
  + * $Id: XMLUni.hpp,v 1.29 2001/07/12 18:50:32 tng Exp $
    */
   
   
  @@ -164,6 +164,7 @@
       static const XMLCh fgXMLStringHTabU[];
       static const XMLCh fgXMLStringCRU[];
       static const XMLCh fgXMLStringLFU[];
  +    static const XMLCh fgXMLDeclString[];
       static const XMLCh fgXMLDeclStringSpace[];
       static const XMLCh fgXMLDeclStringHTab[];
       static const XMLCh fgXMLDeclStringLF[];
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-cvs-help@xml.apache.org