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/26 19:04:11 UTC

cvs commit: xml-xerces/c/src/validators/schema SchemaValidator.cpp TraverseSchema.cpp

tng         01/07/26 10:04:11

  Modified:    c/Projects/Win32/VC6/xerces-all/XercesLib XercesLib.dsp
               c/src/NLS/EN_US XMLErrList_EN_US.Xml
               c/src/framework XMLErrorCodes.hpp
               c/src/internal Makefile.in XMLScanner2.cpp
               c/src/util/MsgLoaders/InMemory CppErrMsgs_EN_US.hpp
               c/src/util/MsgLoaders/MsgCatalog XMLMsgCat_EN_US.Msg
               c/src/util/Platforms/Win32 Version.rc
               c/src/validators/schema SchemaValidator.cpp
                        TraverseSchema.cpp
  Added:       c/src/internal XMLInternalErrorHandler.hpp
  Log:
  Schema: Process should stop after fatal error, and user throws need to be rethrown.
  
  Revision  Changes    Path
  1.76      +4 -0      xml-xerces/c/Projects/Win32/VC6/xerces-all/XercesLib/XercesLib.dsp
  
  Index: XercesLib.dsp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/Projects/Win32/VC6/xerces-all/XercesLib/XercesLib.dsp,v
  retrieving revision 1.75
  retrieving revision 1.76
  diff -u -r1.75 -r1.76
  --- XercesLib.dsp	2001/07/24 18:50:58	1.75
  +++ XercesLib.dsp	2001/07/26 17:04:10	1.76
  @@ -1000,6 +1000,10 @@
   # End Source File
   # Begin Source File
   
  +SOURCE=..\..\..\..\..\src\internal\XMLInternalErrorHandler.hpp
  +# End Source File
  +# Begin Source File
  +
   SOURCE=..\..\..\..\..\src\internal\XMLReader.cpp
   # End Source File
   # Begin Source File
  
  
  
  1.39      +2 -1      xml-xerces/c/src/NLS/EN_US/XMLErrList_EN_US.Xml
  
  Index: XMLErrList_EN_US.Xml
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/NLS/EN_US/XMLErrList_EN_US.Xml,v
  retrieving revision 1.38
  retrieving revision 1.39
  diff -u -r1.38 -r1.39
  --- XMLErrList_EN_US.Xml	2001/07/24 18:32:52	1.38
  +++ XMLErrList_EN_US.Xml	2001/07/26 17:04:10	1.39
  @@ -120,7 +120,7 @@
               <Message Id="EmptyComplexRestrictionDerivation" Text="The content of complexType is EMPTY, but base is not empty or does not have emptiable particle."/>
               <Message Id="MixedOrElementOnly" Text="The content type of the base type:'{0}' and derived type:'{1}' must both be mixed or element-only."/>
               <Message Id="InvalidContentRestriction" Text="The content type is not a valid restriction of the content type of the base."/>
  -            <Message Id="ForbiddenDerivation" Text="Derivation by extension or restriction is forbiden by either the base type '{0}' or the schema"/> 
  +            <Message Id="ForbiddenDerivation" Text="Derivation by extension or restriction is forbiden by either the base type '{0}' or the schema"/>
               <Message Id="AtomicItemType" Text="The {item type definition} must have {variety} of atomic or union (where all member types must be atomic)"/>
               <Message Id="MemberTypeNoUnion" Text="The {member type definitions} must all have {variety} of atomic or list"/>
               <Message Id="GroupContentError" Text="The group:'0' must contain (all | choice | sequence)"/>
  @@ -256,6 +256,7 @@
               <Message Id="UnexpectedError" Text="UnexpectedError"/>
               <Message Id="BadSchemaLocation" Text="The schemaLocation attribute does not contain pairs of values."/>
               <Message Id="NoGrammarResolver" Text="Internal error: don't have a GrammarResolver for TraverseSchema"/>
  +            <Message Id="SchemaScanFatalError" Text="Fatal error encountered during schema scan"/>
           </FatalError>
       </MsgDomain>
       <MsgDomain Domain="http://apache.org/xml/messages/XMLValidity">
  
  
  
  1.19      +2 -1      xml-xerces/c/src/framework/XMLErrorCodes.hpp
  
  Index: XMLErrorCodes.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/framework/XMLErrorCodes.hpp,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- XMLErrorCodes.hpp	2001/07/24 18:30:47	1.18
  +++ XMLErrorCodes.hpp	2001/07/26 17:04:10	1.19
  @@ -260,7 +260,8 @@
         , UnexpectedError                    = 247
         , BadSchemaLocation                  = 248
         , NoGrammarResolver                  = 249
  -      , F_HighBounds                       = 250
  +      , SchemaScanFatalError               = 250
  +      , F_HighBounds                       = 251
       };
   
       static bool isFatal(const XMLErrs::Codes toCheck)
  
  
  
  1.12      +2 -1      xml-xerces/c/src/internal/Makefile.in
  
  Index: Makefile.in
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/internal/Makefile.in,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- Makefile.in	2001/07/06 17:11:56	1.11
  +++ Makefile.in	2001/07/26 17:04:10	1.12
  @@ -54,7 +54,7 @@
   # <http://www.apache.org/>.
   #
   #
  -# $Id: Makefile.in,v 1.11 2001/07/06 17:11:56 tng Exp $
  +# $Id: Makefile.in,v 1.12 2001/07/26 17:04:10 tng Exp $
   #
   
   PLATFORM = @platform@
  @@ -83,6 +83,7 @@
   	ReaderMgr.hpp \
   	VecAttrListImpl.hpp \
   	VecAttributesImpl.hpp \
  +	XMLInternalErrorHandler.hpp \
   	XMLReader.hpp \
   	XMLScanner.hpp
   
  
  
  
  1.50      +7 -18     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.49
  retrieving revision 1.50
  diff -u -r1.49 -r1.50
  --- XMLScanner2.cpp	2001/07/13 21:11:21	1.49
  +++ XMLScanner2.cpp	2001/07/26 17:04:10	1.50
  @@ -55,7 +55,7 @@
    */
   
   /*
  - * $Id: XMLScanner2.cpp,v 1.49 2001/07/13 21:11:21 tng Exp $
  + * $Id: XMLScanner2.cpp,v 1.50 2001/07/26 17:04:10 tng Exp $
    */
   
   
  @@ -87,6 +87,7 @@
   #include <framework/XMLValidator.hpp>
   #include <internal/XMLScanner.hpp>
   #include <internal/EndOfEntityException.hpp>
  +#include <internal/XMLInternalErrorHandler.hpp>
   #include <parsers/DOMParser.hpp>
   #include <dom/DOM_DOMException.hpp>
   #include <sax/EntityResolver.hpp>
  @@ -1295,9 +1296,10 @@
   
       if (!grammar || grammar->getGrammarType() == Grammar::DTDGrammarType) {
           DOMParser parser;
  +        XMLInternalErrorHandler internalErrorHandler(fErrorHandler);
           parser.setValidationScheme(DOMParser::Val_Never);
           parser.setDoNamespaces(true);
  -        parser.setErrorHandler(fErrorHandler);
  +        parser.setErrorHandler((ErrorHandler*) &internalErrorHandler);
           parser.setEntityResolver(fEntityResolver);
   
           // Create a buffer for expanding the system id
  @@ -1365,22 +1367,9 @@
           // Put a janitor on the input source
           Janitor<InputSource> janSrc(srcToFill);
   
  -        try {
  -            parser.parse( *srcToFill) ;
  -        }
  -        catch (const XMLException& e)
  -        {
  -            emitError (XMLErrs::XMLException, e.getType(), e.getMessage());
  -        }
  -        catch (const DOM_DOMException& e)
  -        {
  -            throw e;
  -        }
  -        catch (...)
  -        {
  -            emitError(XMLErrs::UnexpectedError);
  -            throw;
  -        }
  +        parser.parse( *srcToFill) ;
  +        if (internalErrorHandler.getSawFatal() && fExitOnFirstFatal)
  +            emitError(XMLErrs::SchemaScanFatalError);
   
           DOM_Document  document = parser.getDocument(); //Our Grammar
   
  
  
  
  1.1                  xml-xerces/c/src/internal/XMLInternalErrorHandler.hpp
  
  Index: XMLInternalErrorHandler.hpp
  ===================================================================
  
  /*
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2001 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.
   *
   * 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:
   *       "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
   *    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
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * 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
   * Business Machines, Inc., http://www.ibm.com .  For more information
   * on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  /*
   * $Log: XMLInternalErrorHandler.hpp,v $
   * Revision 1.1  2001/07/26 17:04:10  tng
   * Schema: Process should stop after fatal error, and user throws need to be rethrown.
   *
   */
  
  #include <util/XercesDefs.hpp>
  #include <sax/ErrorHandler.hpp>
  
  class XMLInternalErrorHandler : public ErrorHandler
  {
  public:
      // -----------------------------------------------------------------------
      //  Constructors and Destructor
      // -----------------------------------------------------------------------
      XMLInternalErrorHandler(ErrorHandler* userHandler = 0) :
         fSawWarning(false),
         fSawError(false),
         fSawFatal(false),
         fUserErrorHandler(userHandler)
      {
      }
  
      ~XMLInternalErrorHandler()
      {
      }
  
      // -----------------------------------------------------------------------
      //  Implementation of the error handler interface
      // -----------------------------------------------------------------------
      void warning(const SAXParseException& toCatch);
      void error(const SAXParseException& toCatch);
      void fatalError(const SAXParseException& toCatch);
      void resetErrors();
  
      // -----------------------------------------------------------------------
      //  Getter methods
      // -----------------------------------------------------------------------
      bool getSawWarning() const;
      bool getSawError() const;
      bool getSawFatal() const;
  
      // -----------------------------------------------------------------------
      //  Private data members
      //
      //  fSawWarning
      //      This is set if we get any warning, and is queryable via a getter
      //      method.
      //
      //  fSawError
      //      This is set if we get any errors, and is queryable via a getter
      //      method.
      //
      //  fSawFatal
      //      This is set if we get any fatal, and is queryable via a getter
      //      method.
      //
      //  fUserErrorHandler
      //      This is the error handler from user
      // -----------------------------------------------------------------------
      bool    fSawWarning;
      bool    fSawError;
      bool    fSawFatal;
      ErrorHandler* fUserErrorHandler;
  };
  
  inline bool XMLInternalErrorHandler::getSawWarning() const
  {
      return fSawWarning;
  }
  
  inline bool XMLInternalErrorHandler::getSawError() const
  {
      return fSawError;
  }
  
  inline bool XMLInternalErrorHandler::getSawFatal() const
  {
      return fSawFatal;
  }
  
  inline void XMLInternalErrorHandler::warning(const SAXParseException& toCatch)
  {
      fSawWarning = true;
      if (fUserErrorHandler)
          fUserErrorHandler->warning(toCatch);
  }
  
  inline void XMLInternalErrorHandler::error(const SAXParseException& toCatch)
  {
      fSawError = true;
      if (fUserErrorHandler)
          fUserErrorHandler->error(toCatch);
  }
  
  inline void XMLInternalErrorHandler::fatalError(const SAXParseException& toCatch)
  {
      fSawFatal = true;
      if (fUserErrorHandler)
          fUserErrorHandler->fatalError(toCatch);
  }
  
  inline void XMLInternalErrorHandler::resetErrors()
  {
      fSawWarning = false;
      fSawError = false;
      fSawFatal = false;
  }
  
  
  
  1.38      +2 -1      xml-xerces/c/src/util/MsgLoaders/InMemory/CppErrMsgs_EN_US.hpp
  
  Index: CppErrMsgs_EN_US.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/util/MsgLoaders/InMemory/CppErrMsgs_EN_US.hpp,v
  retrieving revision 1.37
  retrieving revision 1.38
  diff -u -r1.37 -r1.38
  --- CppErrMsgs_EN_US.hpp	2001/07/24 18:31:47	1.37
  +++ CppErrMsgs_EN_US.hpp	2001/07/26 17:04:10	1.38
  @@ -254,10 +254,11 @@
     , { 0x0055,0x006E,0x0065,0x0078,0x0070,0x0065,0x0063,0x0074,0x0065,0x0064,0x0045,0x0072,0x0072,0x006F,0x0072,0x00 }
     , { 0x0054,0x0068,0x0065,0x0020,0x0073,0x0063,0x0068,0x0065,0x006D,0x0061,0x004C,0x006F,0x0063,0x0061,0x0074,0x0069,0x006F,0x006E,0x0020,0x0061,0x0074,0x0074,0x0072,0x0069,0x0062,0x0075,0x0074,0x0065,0x0020,0x0064,0x006F,0x0065,0x0073,0x0020,0x006E,0x006F,0x0074,0x0020,0x0063,0x006F,0x006E,0x0074,0x0061,0x0069,0x006E,0x0020,0x0070,0x0061,0x0069,0x0072,0x0073,0x0020,0x006F,0x0066,0x0020,0x0076,0x0061,0x006C,0x0075,0x0065,0x0073,0x002E,0x00 }
     , { 0x0049,0x006E,0x0074,0x0065,0x0072,0x006E,0x0061,0x006C,0x0020,0x0065,0x0072,0x0072,0x006F,0x0072,0x003A,0x0020,0x0064,0x006F,0x006E,0x0027,0x0074,0x0020,0x0068,0x0061,0x0076,0x0065,0x0020,0x0061,0x0020,0x0047,0x0072,0x0061,0x006D,0x006D,0x0061,0x0072,0x0052,0x0065,0x0073,0x006F,0x006C,0x0076,0x0065,0x0072,0x0020,0x0066,0x006F,0x0072,0x0020,0x0054,0x0072,0x0061,0x0076,0x0065,0x0072,0x0073,0x0065,0x0053,0x0063,0x0068,0x0065,0x006D,0x0061,0x00 }
  +  , { 0x0046,0x0061,0x0074,0x0061,0x006C,0x0020,0x0065,0x0072,0x0072,0x006F,0x0072,0x0020,0x0065,0x006E,0x0063,0x006F,0x0075,0x006E,0x0074,0x0065,0x0072,0x0065,0x0064,0x0020,0x0064,0x0075,0x0072,0x0069,0x006E,0x0067,0x0020,0x0073,0x0063,0x0068,0x0065,0x006D,0x0061,0x0020,0x0073,0x0063,0x0061,0x006E,0x00 }
     , { 0x0046,0x005F,0x0045,0x006E,0x0064,0x00 }
   
   };
  -const unsigned int gXMLErrArraySize = 251;
  +const unsigned int gXMLErrArraySize = 252;
   
   const XMLCh gXMLValidityArray[][128] = 
   {
  
  
  
  1.41      +1 -0      xml-xerces/c/src/util/MsgLoaders/MsgCatalog/XMLMsgCat_EN_US.Msg
  
  Index: XMLMsgCat_EN_US.Msg
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/util/MsgLoaders/MsgCatalog/XMLMsgCat_EN_US.Msg,v
  retrieving revision 1.40
  retrieving revision 1.41
  diff -u -r1.40 -r1.41
  --- XMLMsgCat_EN_US.Msg	2001/07/24 18:31:48	1.40
  +++ XMLMsgCat_EN_US.Msg	2001/07/26 17:04:10	1.41
  @@ -244,6 +244,7 @@
   247  UnexpectedError
   248  The schemaLocation attribute does not contain pairs of values.
   249  Internal error: don't have a GrammarResolver for TraverseSchema
  +250  Fatal error encountered during schema scan
   
   
   $set 2
  
  
  
  1.46      +3 -1      xml-xerces/c/src/util/Platforms/Win32/Version.rc
  
  Index: Version.rc
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/util/Platforms/Win32/Version.rc,v
  retrieving revision 1.45
  retrieving revision 1.46
  diff -u -r1.45 -r1.46
  --- Version.rc	2001/07/24 18:31:48	1.45
  +++ Version.rc	2001/07/26 17:04:11	1.46
  @@ -99,6 +99,8 @@
   
   
   
  +
  +
   // ----------------------------------------------------------------
   //  This file was generated from the XML error message source.
   //  so do not edit this file directly!!
  @@ -350,6 +352,7 @@
       247               L"\x0055\x006E\x0065\x0078\x0070\x0065\x0063\x0074\x0065\x0064\x0045\x0072\x0072\x006F\x0072\x00"
       248               L"\x0054\x0068\x0065\x0020\x0073\x0063\x0068\x0065\x006D\x0061\x004C\x006F\x0063\x0061\x0074\x0069\x006F\x006E\x0020\x0061\x0074\x0074\x0072\x0069\x0062\x0075\x0074\x0065\x0020\x0064\x006F\x0065\x0073\x0020\x006E\x006F\x0074\x0020\x0063\x006F\x006E\x0074\x0061\x0069\x006E\x0020\x0070\x0061\x0069\x0072\x0073\x0020\x006F\x0066\x0020\x0076\x0061\x006C\x0075\x0065\x0073\x002E\x00"
       249               L"\x0049\x006E\x0074\x0065\x0072\x006E\x0061\x006C\x0020\x0065\x0072\x0072\x006F\x0072\x003A\x0020\x0064\x006F\x006E\x0027\x0074\x0020\x0068\x0061\x0076\x0065\x0020\x0061\x0020\x0047\x0072\x0061\x006D\x006D\x0061\x0072\x0052\x0065\x0073\x006F\x006C\x0076\x0065\x0072\x0020\x0066\x006F\x0072\x0020\x0054\x0072\x0061\x0076\x0065\x0072\x0073\x0065\x0053\x0063\x0068\x0065\x006D\x0061\x00"
  +    250               L"\x0046\x0061\x0074\x0061\x006C\x0020\x0065\x0072\x0072\x006F\x0072\x0020\x0065\x006E\x0063\x006F\x0075\x006E\x0074\x0065\x0072\x0065\x0064\x0020\x0064\x0075\x0072\x0069\x006E\x0067\x0020\x0073\x0063\x0068\x0065\x006D\x0061\x0020\x0073\x0063\x0061\x006E\x00"
   END
   STRINGTABLE DISCARDABLE
   BEGIN
  @@ -689,7 +692,6 @@
       8437              L"\x007B\x0030\x007D\x00"
       8438              L"\x006F\x0070\x0065\x0072\x0061\x0074\x006F\x0072\x0020\x006E\x0065\x0077\x0020\x0066\x0061\x0069\x006C\x0073\x002E\x0020\x0020\x0050\x006F\x0073\x0073\x0069\x0062\x006C\x0079\x0020\x0072\x0075\x006E\x006E\x0069\x006E\x0067\x0020\x004F\x0066\x0020\x006D\x0065\x006D\x006F\x0072\x0079\x00"
   END
  -
   
   
   #endif    // English (U.S.) resources
  
  
  
  1.11      +6 -0      xml-xerces/c/src/validators/schema/SchemaValidator.cpp
  
  Index: SchemaValidator.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/validators/schema/SchemaValidator.cpp,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- SchemaValidator.cpp	2001/07/24 21:23:40	1.10
  +++ SchemaValidator.cpp	2001/07/26 17:04:11	1.11
  @@ -56,6 +56,9 @@
   
   /*
    * $Log: SchemaValidator.cpp,v $
  + * Revision 1.11  2001/07/26 17:04:11  tng
  + * Schema: Process should stop after fatal error, and user throws need to be rethrown.
  + *
    * Revision 1.10  2001/07/24 21:23:40  tng
    * Schema: Use DatatypeValidator for ID/IDREF/ENTITY/ENTITIES/NOTATION.
    *
  @@ -252,6 +255,7 @@
               }
               catch (...) {
                   emitError(XMLValid::GenericError);
  +                throw;
               }
           }
       }
  @@ -445,6 +449,7 @@
                                   }
                                   catch (...) {
                                       emitError(XMLValid::GenericError);
  +                                    throw;
                                   }
                               }
                           }
  @@ -532,6 +537,7 @@
               }
               catch (...) {
                   emitError(XMLValid::GenericError);
  +                throw;
               }
           }
       }
  
  
  
  1.33      +49 -67    xml-xerces/c/src/validators/schema/TraverseSchema.cpp
  
  Index: TraverseSchema.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/validators/schema/TraverseSchema.cpp,v
  retrieving revision 1.32
  retrieving revision 1.33
  diff -u -r1.32 -r1.33
  --- TraverseSchema.cpp	2001/07/24 18:33:46	1.32
  +++ TraverseSchema.cpp	2001/07/26 17:04:11	1.33
  @@ -55,7 +55,7 @@
    */
   
   /*
  - * $Id: TraverseSchema.cpp,v 1.32 2001/07/24 18:33:46 knoaman Exp $
  + * $Id: TraverseSchema.cpp,v 1.33 2001/07/26 17:04:11 tng Exp $
    */
   
   // ---------------------------------------------------------------------------
  @@ -82,6 +82,7 @@
   #include <framework/XMLValidityCodes.hpp>
   #include <framework/XMLErrorCodes.hpp>
   #include <internal/XMLScanner.hpp>
  +#include <internal/XMLInternalErrorHandler.hpp>
   #include <framework/XMLValidator.hpp>
   #include <sax/EntityResolver.hpp>
   #include <util/XMLURL.hpp>
  @@ -244,7 +245,7 @@
       }
   
       unsigned int schemaURLId = fURIStringPool->addOrFind(fCurrentSchemaURL);
  -    fImportLocations->addElement(schemaURLId);    
  +    fImportLocations->addElement(schemaURLId);
   
       if (fSchemaRootElement.isNull()) {
           // REVISIT: Anything to do?
  @@ -349,7 +350,7 @@
   
       // Handle identity constraints
       // TO DO
  -    
  +
       // Element consistency checks - substitution groups
       checkRefElementConsistency();
   }
  @@ -451,27 +452,17 @@
       // Parse input source
       // ------------------------------------------------------------------
       DOMParser parser;
  +    XMLInternalErrorHandler internalErrorHandler(fErrorHandler);
   
       parser.setValidationScheme(DOMParser::Val_Never);
       parser.setDoNamespaces(true);
  -    parser.setErrorHandler(fErrorHandler);
  +    parser.setErrorHandler((ErrorHandler*) &internalErrorHandler);
       parser.setEntityResolver(fEntityResolver);
   
  -    try {
  -        parser.parse(*srcToFill);
  -    }
  -    catch (const XMLException& e) {
  -        reportSchemaError(XMLUni::fgXMLErrDomain, XMLErrs::XMLException,
  -                          e.getType(), e.getMessage());
  -    }
  -    catch (const DOM_DOMException& e) {
  -        throw e;
  -    }
  -    catch (...) {
  +    parser.parse(*srcToFill);
   
  -        reportSchemaError(XMLUni::fgXMLErrDomain, XMLErrs::UnexpectedError);
  -        throw;
  -    }
  +    if (internalErrorHandler.getSawFatal() && fScanner->getExitOnFirstFatal())
  +        reportSchemaError(XMLUni::fgXMLErrDomain, XMLErrs::SchemaScanFatalError);
   
       // ------------------------------------------------------------------
       // Get root element
  @@ -630,27 +621,18 @@
       // Parse input source
       // ------------------------------------------------------------------
       DOMParser parser;
  +    XMLInternalErrorHandler internalErrorHandler(fErrorHandler);
   
       parser.setValidationScheme(DOMParser::Val_Never);
       parser.setDoNamespaces(true);
  -    parser.setErrorHandler(fErrorHandler);
  +    parser.setErrorHandler((ErrorHandler*) &internalErrorHandler);
       parser.setEntityResolver(fEntityResolver);
   
  -    try {
  -        parser.parse(*srcToFill);
  -    }
  -    catch (const XMLException& e) {
  -        reportSchemaError(XMLUni::fgXMLErrDomain, XMLErrs::XMLException,
  -                          e.getType(), e.getMessage());
  -    }
  -    catch (const DOM_DOMException& e) {
  -        throw e;
  -    }
  -    catch (...) {
  +    parser.parse(*srcToFill);
   
  -        reportSchemaError(XMLUni::fgXMLErrDomain, XMLErrs::UnexpectedError);
  -        throw;
  -    }
  +    if (internalErrorHandler.getSawFatal() && fScanner->getExitOnFirstFatal())
  +        reportSchemaError(XMLUni::fgXMLErrDomain, XMLErrs::SchemaScanFatalError);
  +
   
       // ------------------------------------------------------------------
       // Get root element
  @@ -760,7 +742,7 @@
   
                   if (hasAllContent(contentSpecNode)) {
   
  -                    reportSchemaError(XMLUni::fgXMLErrDomain, XMLErrs::AllContentLimited);                    
  +                    reportSchemaError(XMLUni::fgXMLErrDomain, XMLErrs::AllContentLimited);
                       continue;
                   }
               }
  @@ -804,7 +786,7 @@
   
           if (left == 0) {
               left = expandedSpecNode;
  -            toAdoptLeft = adoptSpecNode; 
  +            toAdoptLeft = adoptSpecNode;
           }
           else if (right == 0) {
               right = expandedSpecNode;
  @@ -1022,7 +1004,7 @@
       // Register the type first, so that in case of a recursive element type
       // declaration, we can retrieve the complexType info (though the rest of
       // complex type information has not been added).
  -    RefHashTableOf<ComplexTypeInfo>* complexTypeRegistry = 
  +    RefHashTableOf<ComplexTypeInfo>* complexTypeRegistry =
           (topLevel || !fRefSchemaGrammar) ? fComplexTypeRegistry
                                            : fRefSchemaGrammar->getComplexTypeRegistry();
   
  @@ -1202,7 +1184,7 @@
           reportSchemaError(XMLUni::fgXMLErrDomain, XMLErrs::GroupContentError, name);
       }
       else {
  -        
  +
           if (elem.getAttributeNode(SchemaSymbols::fgATT_MINOCCURS) != 0
               || elem.getAttributeNode(SchemaSymbols::fgATT_MAXOCCURS) != 0) {
               reportSchemaError(XMLUni::fgXMLErrDomain, XMLErrs::MinMaxOnGroupChild);
  @@ -1314,7 +1296,7 @@
       const XMLCh* fullName = fStringPool.getValueForId(fullNameIndex);
       ContentSpecNode* specNode = 0;
       XercesGroupInfo* saveGroupInfo = fCurrentGroupInfo;
  -    XercesGroupInfo* groupInfo = new XercesGroupInfo();    
  +    XercesGroupInfo* groupInfo = new XercesGroupInfo();
   
       fCurrentGroupStack->addElement(fullNameIndex);
       fCurrentGroupInfo = groupInfo;
  @@ -1330,7 +1312,7 @@
           reportSchemaError(XMLUni::fgXMLErrDomain, XMLErrs::GroupContentError, groupName);
       }
       else {
  -        
  +
           if (elem.getAttributeNode(SchemaSymbols::fgATT_MINOCCURS) != 0
               || elem.getAttributeNode(SchemaSymbols::fgATT_MAXOCCURS) != 0) {
               reportSchemaError(XMLUni::fgXMLErrDomain, XMLErrs::MinMaxOnGroupChild);
  @@ -2064,7 +2046,7 @@
               fRefSchemaGrammar->putElemDecl(elemDecl);
           }
   
  -        if (fCurrentGroupInfo && 
  +        if (fCurrentGroupInfo &&
               elemDecl->getEnclosingScope() == fCurrentGroupInfo->getScope()) {
               fCurrentGroupInfo->addElement(elemDecl);
           }
  @@ -2177,10 +2159,10 @@
   
           SchemaElementDecl* subsElemDecl =
                       getSubstituteGroupElemDecl(subsGroupName, noErrorFound);
  -        
  +
           if (subsElemDecl != 0) {
   
  -            // An element cannot substitute itself 
  +            // An element cannot substitute itself
               if (subsElemDecl == elemDecl) {
                   // REVISIT - add proper error message
   
  @@ -2205,7 +2187,7 @@
                       fBuffer.append(chComma);
                       fBuffer.append(localPart);
   
  -                    if (!isDuplicate) {                  
  +                    if (!isDuplicate) {
   
                           XMLCh* elemBaseName = elemDecl->getBaseName();
                           XMLCh* subsElemBaseName = subsElemDecl->getBaseName();
  @@ -2214,7 +2196,7 @@
   
                           elemDecl->setSubstitutionGroupName(fBuffer.getRawBuffer());
                           fSubstitutionGroups->put((void*) elemBaseName, elemURI, subsElemDecl);
  -                        RefVectorOf<SchemaElementDecl>* subsElements = 
  +                        RefVectorOf<SchemaElementDecl>* subsElements =
                              fValidSubstitutionGroups->get(subsElemBaseName, subsElemURI);
   
                           if (!subsElements) {
  @@ -2904,7 +2886,7 @@
   
                   if (simpleTypeNameIndex !=-1) {
   
  -                    DatatypeValidator* simpleTypeDV = 
  +                    DatatypeValidator* simpleTypeDV =
                           fDatatypeRegistry->getDatatypeValidator(fStringPool.getValueForId(simpleTypeNameIndex));
   
                       // Check that the simpleType validator is validly derived
  @@ -3394,7 +3376,7 @@
   void TraverseSchema::extractTopLevel3Components(const DOM_Element& rootElem) {
   
       for (DOM_Element child = XUtil::getFirstChildElement(rootElem);
  -	     child != 0; 
  +	     child != 0;
   		 child = XUtil::getNextSiblingElement(child)) {
   
           DOMString name = child.getLocalName();
  @@ -3808,7 +3790,7 @@
       int blockSet = 0;
   
       if (!XMLString::compareString(blockStr, SchemaSymbols::fgATTVAL_POUNDALL)) {
  -        
  +
           blockSet = SchemaSymbols::EXTENSION + SchemaSymbols::RESTRICTION;
   		
   		if (blockType == ES_Block) {
  @@ -4430,7 +4412,7 @@
   
       unsigned int minOccurs = 0;
       unsigned int maxOccurs = 0;
  -    const XMLCh* minOccursStr = 
  +    const XMLCh* minOccursStr =
           getElementAttValue(elem, SchemaSymbols::fgATT_MINOCCURS, true);
       const XMLCh* maxOccursStr =
           getElementAttValue(elem, SchemaSymbols::fgATT_MAXOCCURS, true);
  @@ -4480,7 +4462,7 @@
       bool isAllElement = (allContextFlag == All_Element);
       bool isAllGroup = (allContextFlag == All_Group);
       bool isGroupRefAll = (allContextFlag == Group_Ref_With_All);
  -    
  +
       if (isAllElement || isAllGroup || isGroupRefAll) {
   
           if (maxOccurs != 1
  @@ -4508,7 +4490,7 @@
       if (minOccurs == 1 && maxOccurs == 1) {
       }
       else if (minOccurs == 0 && maxOccurs == 1) {
  -        
  +
           retNode = new ContentSpecNode(ContentSpecNode::ZeroOrOne,
                                         retNode, 0, toAdoptSpecNode);
       }
  @@ -4598,7 +4580,7 @@
       bool             adoptSpecNode = true;
       ComplexTypeInfo* baseTypeInfo = typeInfo->getBaseComplexTypeInfo();
   
  -    if (baseTypeInfo) {       
  +    if (baseTypeInfo) {
   
           if (typeInfo->getDerivedBy() == SchemaSymbols::RESTRICTION) {
   
  @@ -4627,7 +4609,7 @@
               int baseContentType = baseTypeInfo->getContentType();
   
               if (baseContentType != SchemaElementDecl::Empty) {
  -                if ((isMixed && baseContentType == SchemaElementDecl::Children) 
  +                if ((isMixed && baseContentType == SchemaElementDecl::Children)
                       || (!isMixed && baseContentType == SchemaElementDecl::Mixed)) {
   
                       reportSchemaError(XMLUni::fgXMLErrDomain, XMLErrs::MixedOrElementOnly, baseLocalPart, typeName);
  @@ -4650,7 +4632,7 @@
   
           if (childName.equals(SchemaSymbols::fgELT_GROUP)) {
   
  -            bool             adoptSpecNode = true;    
  +            bool             adoptSpecNode = true;
               XercesGroupInfo* grpInfo = traverseGroupDecl(childElem, adoptSpecNode);
   
               if (grpInfo) {
  @@ -4746,9 +4728,9 @@
               // the whole schema.
           }
           else {
  -            
  +
               // Compose the final content model by concatenating the base and
  -            // the current in sequence            
  +            // the current in sequence
               if (!specNode) {
   
                   typeInfo->setContentSpec(baseSpecNode);
  @@ -5271,7 +5253,7 @@
                   max = maxSecond;
               }
               else {
  -                if (nodeType == ContentSpecNode::Choice) {                
  +                if (nodeType == ContentSpecNode::Choice) {
                       max = (max > maxSecond) ? max : maxSecond;
                   }
                   else {
  @@ -5289,10 +5271,10 @@
                                        const DatatypeValidator* const baseDV,
                                        unsigned int& flags)
   {
  -    const XMLCh* fixedFacet = 
  +    const XMLCh* fixedFacet =
                       getElementAttValue(elem, SchemaSymbols::fgATT_FIXED);
   
  -    if (fixedFacet && 
  +    if (fixedFacet &&
           (!XMLString::compareString(fixedFacet, SchemaSymbols::fgATTVAL_TRUE)
            || !XMLString::compareString(fixedFacet, fgValueOne))) {
   
  @@ -5334,8 +5316,8 @@
       for (unsigned int i=0; i < refElemSize; i++) {
   
           int elemScope = fRefElemScope->elementAt(i);
  -        SchemaElementDecl* elem = fRefElements->elementAt(i);     
  -        RefVectorOf<SchemaElementDecl>* subsElements = 
  +        SchemaElementDecl* elem = fRefElements->elementAt(i);
  +        RefVectorOf<SchemaElementDecl>* subsElements =
               fValidSubstitutionGroups->get(elem->getBaseName(), elem->getURI());
   
           if (subsElements) {
  @@ -5348,7 +5330,7 @@
                   SchemaElementDecl* sameScopeElem = (SchemaElementDecl*)
                       fSchemaGrammar->getElemDecl(subsElem->getURI(), subsElemName, 0, elemScope);
   
  -                if (sameScopeElem 
  +                if (sameScopeElem
                       && (subsElem->getComplexTypeInfo() != sameScopeElem->getComplexTypeInfo()
                           || subsElem->getDatatypeValidator() != sameScopeElem->getDatatypeValidator())) {
                       reportSchemaError(XMLUni::fgXMLErrDomain, XMLErrs::DuplicateElementDeclaration, subsElemName);
  @@ -5477,7 +5459,7 @@
           }
           else {
   
  -            DOM_Element groupElem = 
  +            DOM_Element groupElem =
                   getTopLevelComponentByName(SchemaSymbols::fgELT_GROUP, localPart);
   
               if (groupElem != 0) {
  @@ -5490,7 +5472,7 @@
       }
   
       // copy ref'd group elements
  -    if (fCurrentGroupInfo 
  +    if (fCurrentGroupInfo
           && groupInfo->getScope() == fCurrentGroupInfo->getScope()) {
           copyGroupElements(fCurrentGroupInfo, groupInfo);
       }
  @@ -5509,7 +5491,7 @@
           int emptyURI = fURIStringPool->addOrFind(XMLUni::fgZeroLenString);
   
           for (unsigned int i=0; i < elemCount; i++) {
  -        
  +
               const SchemaGrammar*     aGrammar = schemaGrammar;
               SchemaElementDecl* elemDecl = groupInfo->elementAt(i);
               int                elemURI = elemDecl->getURI();
  @@ -5536,7 +5518,7 @@
                   }
               }
               else {
  -            
  +
                   int elemScope = elemDecl->getEnclosingScope();
   
                   fCurrentComplexType->addElement(elemDecl);
  @@ -5576,7 +5558,7 @@
           int emptyURI = fURIStringPool->addOrFind(XMLUni::fgZeroLenString);
   
           for (unsigned int i=0; i < elemCount; i++) {
  - 
  +
               SchemaGrammar*     aGrammar = fSchemaGrammar;
               SchemaElementDecl* elemDecl = baseTypeInfo->elementAt(i);
   
  @@ -5608,7 +5590,7 @@
                   }
               }
               else {
  -            
  +
                   int elemScope = elemDecl->getEnclosingScope();
   
                   newTypeInfo->addElement(elemDecl);
  
  
  

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