You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by kn...@apache.org on 2001/05/03 21:09:45 UTC

cvs commit: xml-xerces/c/tools/NLS/Xlat Xlat.cpp Xlat.hpp

knoaman     01/05/03 12:09:43

  Modified:    c/src/framework XMLErrorReporter.hpp XMLValidator.cpp
               c/src/internal XMLScanner.cpp XMLScanner.hpp
               c/src/parsers DOMParser.cpp DOMParser.hpp SAXParser.cpp
                        SAXParser.hpp
               c/tools/NLS/Xlat Xlat.cpp Xlat.hpp
  Log:
  Support Warning/Error/FatalError messaging.
  Validity constraints errors are treated as errors, with the ability by user to set
  validity constraints as fatal errors.
  
  Revision  Changes    Path
  1.10      +4 -1      xml-xerces/c/src/framework/XMLErrorReporter.hpp
  
  Index: XMLErrorReporter.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/framework/XMLErrorReporter.hpp,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- XMLErrorReporter.hpp	2000/12/14 18:49:57	1.9
  +++ XMLErrorReporter.hpp	2001/05/03 19:08:56	1.10
  @@ -56,6 +56,11 @@
   
    /*
     * $Log: XMLErrorReporter.hpp,v $
  +  * Revision 1.10  2001/05/03 19:08:56  knoaman
  +  * Support Warning/Error/FatalError messaging.
  +  * Validity constraints errors are treated as errors, with the ability by user to set
  +  * validity constraints as fatal errors.
  +  *
     * Revision 1.9  2000/12/14 18:49:57  tng
     * Fix API document generation warning: "Warning: end of member group without matching begin"
     *
  @@ -119,7 +124,7 @@
       enum ErrTypes
       {
           ErrType_Warning
  -        , ErrType_Invalid
  +        , ErrType_Error
           , ErrType_Fatal
   
           , ErrTypes_Unknown
  
  
  
  1.8       +9 -3      xml-xerces/c/src/framework/XMLValidator.cpp
  
  Index: XMLValidator.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/framework/XMLValidator.cpp,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- XMLValidator.cpp	2001/03/21 21:56:02	1.7
  +++ XMLValidator.cpp	2001/05/03 19:08:58	1.8
  @@ -56,6 +56,11 @@
   
   /**
     * $Log: XMLValidator.cpp,v $
  +  * Revision 1.8  2001/05/03 19:08:58  knoaman
  +  * Support Warning/Error/FatalError messaging.
  +  * Validity constraints errors are treated as errors, with the ability by user to set
  +  * validity constraints as fatal errors.
  +  *
     * Revision 1.7  2001/03/21 21:56:02  tng
     * Schema: Add Schema Grammar, Schema Validator, and split the DTDValidator into DTDValidator, DTDScanner, and DTDGrammar.
     *
  @@ -193,7 +198,8 @@
       }
   
       // Bail out if its fatal an we are to give up on the first fatal error
  -    if ((XMLValid::isValid(toEmit) || XMLValid::isFatal(toEmit))
  +    if (((XMLValid::isError(toEmit) && fScanner->getValidationConstraintFatal())
  +         || XMLValid::isFatal(toEmit))
       &&  fScanner->getExitOnFirstFatal()
       &&  !fScanner->getInException())
       {
  @@ -248,7 +254,8 @@
       }
   
       // Bail out if its fatal an we are to give up on the first fatal error
  -    if ((XMLValid::isValid(toEmit) || XMLValid::isFatal(toEmit))
  +    if (((XMLValid::isError(toEmit) && fScanner->getValidationConstraintFatal())
  +         || XMLValid::isFatal(toEmit))
       &&  fScanner->getExitOnFirstFatal()
       &&  !fScanner->getInException())
       {
  @@ -303,7 +310,8 @@
       }
   
       // Bail out if its fatal an we are to give up on the first fatal error
  -    if ((XMLValid::isValid(toEmit) || XMLValid::isFatal(toEmit))
  +    if (((XMLValid::isError(toEmit) && fScanner->getValidationConstraintFatal())
  +         || XMLValid::isFatal(toEmit))
       &&  fScanner->getExitOnFirstFatal()
       &&  !fScanner->getInException())
       {
  
  
  
  1.36      +155 -85   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.35
  retrieving revision 1.36
  diff -u -r1.35 -r1.36
  --- XMLScanner.cpp	2001/04/19 18:16:59	1.35
  +++ XMLScanner.cpp	2001/05/03 19:09:06	1.36
  @@ -55,7 +55,7 @@
    */
   
   /*
  - * $Id: XMLScanner.cpp,v 1.35 2001/04/19 18:16:59 tng Exp $
  + * $Id: XMLScanner.cpp,v 1.36 2001/05/03 19:09:06 knoaman Exp $
    */
   
   
  @@ -157,8 +157,11 @@
       , fDocTypeHandler(0)
       , fDoNamespaces(false)
       , fEntityHandler(0)
  +    , fEntityResolver(0)
       , fErrorReporter(0)
  +    , fErrorHandler(0)
       , fExitOnFirstFatal(true)
  +    , fValidationConstraintFatal(false)
       , fIDRefList(0)
       , fInException(false)
       , fRawAttrList(0)
  @@ -199,8 +202,11 @@
       , fDocTypeHandler(docTypeHandler)
       , fDoNamespaces(false)
       , fEntityHandler(entityHandler)
  +    , fEntityResolver(0)
       , fErrorReporter(errHandler)
  +    , fErrorHandler(0)
       , fExitOnFirstFatal(true)
  +    , fValidationConstraintFatal(false)
       , fIDRefList(0)
       , fInException(false)
       , fRawAttrList(0)
  @@ -889,7 +895,7 @@
       fEntityDeclPool->put(new DTDEntityDecl(gApos, chSingleQuote, true, true));
   }
   
  -void XMLScanner::resetURIPool() {
  +void XMLScanner::resetURIStringPool() {
       fURIStringPool->flushAll();
   
       fEmptyNamespaceId   = fURIStringPool->addOrFind(XMLUni::fgZeroLenString);
  @@ -1535,11 +1541,10 @@
           return;
       }
   
  -    unsigned int elemId;
  -    unsigned int uriId = 0;
  +    unsigned int uriId = fEmptyNamespaceId;
  +    XMLBufBid bbName(&fBufMgr);
       if (fDoNamespaces)
       {
  -        XMLBufBid bbName(&fBufMgr);
           XMLBufBid bbPrefix(&fBufMgr);
           uriId = resolveQName
           (
  @@ -1548,25 +1553,6 @@
               , bbPrefix.getBuffer()
               , ElemStack::Mode_Element
           );
  -
  -        //
  -        //  Ask the grammar for the element id for the {uri}name we got. He owns
  -        //  the element decl pool.
  -        //
  -        //  It should be found in the current grammar, no need to switch grammar.
  -        //  If not found, it is an error (unbalanced element)
  -
  -        elemId = fGrammar->getElemId
  -        (
  -            uriId
  -            , bbName.getBuffer().getRawBuffer()
  -            , qnameBuf.getRawBuffer()
  -            , 0
  -        );
  -    }
  -     else
  -    {
  -        elemId = fGrammar->getElemId(fEmptyNamespaceId, 0, qnameBuf.getRawBuffer(), 0);
       }
   
       //
  @@ -1579,23 +1565,38 @@
       //
       const ElemStack::StackElem* topElem = fElemStack.popTop();
   
  +    // See if it was the root element, to avoid multiple calls below
  +    const bool isRoot = fElemStack.isEmpty();
  +
       // Make sure that its the end of the element that we expect
  -    if (topElem->fThisElement->getId() != elemId)
  -    {
  -        emitError
  -        (
  -            XMLErrs::ExpectedEndOfTagX
  -            , topElem->fThisElement->getFullName()
  -        );
  +    XMLElementDecl* tempElement = topElem->fThisElement;
  +    if (fDoNamespaces) {
  +        if ((tempElement->getURI() != uriId) ||
  +            (XMLString::compareString(tempElement->getBaseName(), bbName.getRawBuffer())))
  +        {
  +            emitError
  +            (
  +                XMLErrs::ExpectedEndOfTagX
  +                , topElem->fThisElement->getFullName()
  +            );
  +        }
       }
  +    else {
  +        if (XMLString::compareString(tempElement->getFullName(), qnameBuf.getRawBuffer()))
  +        {
  +            emitError
  +            (
  +                XMLErrs::ExpectedEndOfTagX
  +                , topElem->fThisElement->getFullName()
  +            );
  +        }
  +    }
  +
   
       // Make sure we are back on the same reader as where we started
       if (topElem->fReaderNum != fReaderMgr.getCurrentReaderNum())
           emitError(XMLErrs::PartialTagMarkupError);
   
  -    // See if it was the root element, to avoid multiple calls below
  -    const bool isRoot = fElemStack.isEmpty();
  -
       // Skip optional whitespace
       fReaderMgr.skipPastSpaces();
   
  @@ -1628,7 +1629,7 @@
       {
           int res = fValidator->checkContent
           (
  -            topElem->fThisElement->getId()
  +            topElem->fThisElement
               , topElem->fChildren
               , topElem->fChildCount
           );
  @@ -1660,19 +1661,10 @@
               }
                else
               {
  -                // Find the element decl for the evil spawn
  -                XMLElementDecl* decl = fGrammar->getElemDecl
  -                (
  -                    topElem->fChildren[res]->getURI()
  -                  , topElem->fChildren[res]->getLocalPart()
  -                  , topElem->fChildren[res]->getRawName()
  -                  , 0
  -                );
  -
                   fValidator->emitError
                   (
                       XMLValid::ElementNotValidForContent
  -                    , decl->getFullName()
  +                    , topElem->fChildren[res]->getRawName()
                       , topElem->fThisElement->getFormattedContentModel()
                   );
               }
  @@ -1682,17 +1674,22 @@
       // If this was the root, then done with content
       gotData = !isRoot;
   
  -    if (gotData && fDoNamespaces) {
  -        // Restore the grammar
  -        const ElemStack::StackElem* topElem2 = fElemStack.topElement();
  -        XMLBuffer bufURI;
  -        getURIText(topElem2->fThisElement->getURI(), bufURI);
  -        if (!switchGrammar(bufURI.getRawBuffer()) && fValidate)
  -            fValidator->emitError
  -            (
  -                XMLValid::GrammarNotFound
  -                , bufURI.getRawBuffer()
  -            );
  +    if (gotData) {
  +        if (fDoNamespaces) {
  +            // Restore the grammar
  +            const ElemStack::StackElem* topElem2 = fElemStack.topElement();
  +            XMLBuffer bufURI;
  +            getURIText(topElem2->fThisElement->getURI(), bufURI);
  +            if (!switchGrammar(bufURI.getRawBuffer()) && fValidate)
  +                fValidator->emitError
  +                (
  +                    XMLValid::GrammarNotFound
  +                    , bufURI.getRawBuffer()
  +                );
  +        }
  +
  +        // Restore the validation flag
  +        fValidate = fElemStack.getValidationFlag();
       }
   }
   
  @@ -2067,14 +2064,14 @@
       //
       //  We tell him to fault in a decl if he does not find one.
       //
  -    bool wasAdded;
  +    bool wasAdded = false;
       XMLElementDecl* elemDecl = fGrammar->findOrAddElemDecl
       (
           fEmptyNamespaceId
           , 0
           , 0
           , fQNameBuf.getRawBuffer()
  -        , 0
  +        , Grammar::TOP_LEVEL_SCOPE
           , wasAdded
       );
   
  @@ -2124,6 +2121,7 @@
   
       // Expand the element stack and add the new element
       fElemStack.addLevel(elemDecl, fReaderMgr.getCurrentReaderNum());
  +    fElemStack.setValidationFlag(fValidate);
   
       //
       //  If this is the first element and we are validating, check the root
  @@ -2258,6 +2256,7 @@
               //  not validating of course it will not be at first, but we will
               //  fault it into the pool (to avoid lots of redundant errors.)
               //
  +            wasAdded = false;
               XMLAttDef* attDef = elemDecl->findAttr
               (
                   fAttNameBuf.getRawBuffer()
  @@ -2386,7 +2385,7 @@
                   {
                       fValidator->validateAttrValue
                       (
  -                        *attDef
  +                        attDef
                           , fAttValueBuf.getRawBuffer()
                       );
                   }
  @@ -2568,7 +2567,7 @@
           // If validating, then insure that its legal to have no content
           if (fValidate)
           {
  -            const int res = fValidator->checkContent(elemDecl->getId(), 0, 0);
  +            const int res = fValidator->checkContent(elemDecl, 0, 0);
               if (res >= 0)
               {
                   fValidator->emitError
  @@ -2681,12 +2680,28 @@
       );
       const bool gotAttrs = (attCount != 0);
   
  +    // save the contentleafname and currentscope before addlevel, for later use
  +    ContentLeafNameTypeVector* cv = 0;
  +    int currentScope = Grammar::TOP_LEVEL_SCOPE;
  +    if (!isRoot && fGrammar->getGrammarType() == Grammar::SchemaGrammarType) {
  +        SchemaElementDecl* tempElement = (SchemaElementDecl*) fElemStack.topElement()->fThisElement;
  +        SchemaElementDecl::ModelTypes modelType = tempElement->getModelType();
  +
  +        if ((modelType == SchemaElementDecl::Mixed)
  +          ||  (modelType == SchemaElementDecl::Children))
  +        {
  +            cv = tempElement->getContentModel()->getContentLeafNameTypeVector();
  +            currentScope = fElemStack.getCurrentScope();
  +        }
  +    }
  +
       //
       //  Now, since we might have to update the namespace map for this element,
       //  but we don't have the element decl yet, we just tell the element stack
       //  to expand up to get ready.
       //
       fElemStack.addLevel();
  +    fElemStack.setValidationFlag(fValidate);
   
       //
       //  Make an initial pass through the list and find any xmlns attributes or
  @@ -2703,9 +2718,9 @@
           XMLElementDecl* elemDecl = fGrammar->getElemDecl
           (
               fEmptyNamespaceId
  -            , fNameBuf.getRawBuffer()
  -            , fQNameBuf.getRawBuffer()
               , 0
  +            , fQNameBuf.getRawBuffer()
  +            , Grammar::TOP_LEVEL_SCOPE
           );
           if (elemDecl) {
               if (elemDecl->hasAttDefs()) {
  @@ -2743,6 +2758,13 @@
               , ElemStack::Mode_Element
           );
   
  +    //if schema, check if we should lax or skip the validation of this element
  +    bool laxThisOne = false;
  +    if (cv) {
  +        QName element(fPrefixBuf.getRawBuffer(), fNameBuf.getRawBuffer(), uriId);
  +        laxThisOne = laxElementValidation(&element, cv);
  +    }
  +
       //
       //  Look up the element now in the grammar. This will get us back a
       //  generic element decl object. We tell him to fault one in if he does
  @@ -2754,7 +2776,7 @@
       if (uriId != fEmptyNamespaceId) {
           XMLBuffer bufURI;
           getURIText(uriId, bufURI);
  -        if (!switchGrammar(bufURI.getRawBuffer()) && fValidate)
  +        if (!switchGrammar(bufURI.getRawBuffer()) && fValidate && !laxThisOne)
           {
               fValidator->emitError
               (
  @@ -2762,15 +2784,25 @@
                   , bufURI.getRawBuffer()
               );
           }
  -        elemDecl = fGrammar->findOrAddElemDecl
  -        (
  -            uriId
  -            , fNameBuf.getRawBuffer()
  -            , fPrefixBuf.getRawBuffer()
  -            , fQNameBuf.getRawBuffer()
  -            , 0
  -            , wasAdded
  -        );
  +        elemDecl = fGrammar->getElemDecl
  +                   (
  +                      uriId
  +                    , fNameBuf.getRawBuffer()
  +                    , fQNameBuf.getRawBuffer()
  +                    , currentScope
  +                    );
  +        if (!elemDecl) {
  +            // if not found, then it may be a reference, try TOP_LEVEL_SCOPE
  +            elemDecl = fGrammar->findOrAddElemDecl
  +            (
  +                uriId
  +                , fNameBuf.getRawBuffer()
  +                , fPrefixBuf.getRawBuffer()
  +                , fQNameBuf.getRawBuffer()
  +                , Grammar::TOP_LEVEL_SCOPE
  +                , wasAdded
  +            );
  +        }
       }
       else
       {
  @@ -2782,12 +2814,23 @@
                         uriId
                       , fNameBuf.getRawBuffer()
                       , fQNameBuf.getRawBuffer()
  -                    , 0
  +                    , currentScope
                       );
   
  +        if (!elemDecl) {
  +            // if not found, then it may be a reference, try TOP_LEVEL_SCOPE
  +            elemDecl = fGrammar->getElemDecl
  +                       (
  +                          uriId
  +                        , fNameBuf.getRawBuffer()
  +                        , fQNameBuf.getRawBuffer()
  +                        , Grammar::TOP_LEVEL_SCOPE
  +                        );
  +        }
  +
           if (!elemDecl)
           {
  -            if (!switchGrammar(XMLUni::fgZeroLenString) && fValidate)
  +            if (!switchGrammar(XMLUni::fgZeroLenString) && fValidate && !laxThisOne)
               {
                   fValidator->emitError
                   (
  @@ -2795,15 +2838,27 @@
                       , XMLUni::fgZeroLenString
                   );
               }
  -            elemDecl = fGrammar->findOrAddElemDecl
  -            (
  -                uriId
  -                , fNameBuf.getRawBuffer()
  -                , fPrefixBuf.getRawBuffer()
  -                , fQNameBuf.getRawBuffer()
  -                , 0
  -                , wasAdded
  -            );
  +
  +            elemDecl = fGrammar->getElemDecl
  +                       (
  +                          uriId
  +                        , fNameBuf.getRawBuffer()
  +                        , fQNameBuf.getRawBuffer()
  +                        , currentScope
  +                        );
  +
  +            if (!elemDecl) {
  +                // if not found, then it may be a reference, try TOP_LEVEL_SCOPE
  +                elemDecl = fGrammar->findOrAddElemDecl
  +                (
  +                    uriId
  +                    , fNameBuf.getRawBuffer()
  +                    , fPrefixBuf.getRawBuffer()
  +                    , fQNameBuf.getRawBuffer()
  +                    , Grammar::TOP_LEVEL_SCOPE
  +                    , wasAdded
  +                );
  +            }
           }
       }
   
  @@ -2813,11 +2868,16 @@
       //
       if (wasAdded)
       {
  +        if (laxThisOne) {
  +            fValidate = false;
  +            fElemStack.setValidationFlag(fValidate);
  +        }
  +
           // If validating then emit an error
           if (fValidate)
           {
               // This is to tell the reuse Validator that this element was
  -            // faulted-in, was not an element in the validator pool originally
  +            // faulted-in, was not an element in the grammar pool originally
               elemDecl->setCreateReason(XMLElementDecl::JustFaultIn);
   
               fValidator->emitError
  @@ -2848,12 +2908,22 @@
           }
       }
   
  +    //  Validate the element
  +    if (fValidate)
  +        fValidator->validateElement(elemDecl);
  +
       //
       //  Now we can update the element stack to set the current element
       //  decl. We expanded the stack above, but couldn't store the element
       //  decl because we didn't know it yet.
       //
       fElemStack.setElement(elemDecl, fReaderMgr.getCurrentReaderNum());
  +    if (fGrammar->getGrammarType() == Grammar::SchemaGrammarType) {
  +        ComplexTypeInfo* typeinfo = ((SchemaElementDecl*)elemDecl)->getComplexTypeInfo();
  +        if (typeinfo)
  +            currentScope = typeinfo->getScopeDefined();
  +        fElemStack.setCurrentScope(currentScope);
  +    }
   
       //
       //  If this is the first element and we are validating, check the root
  @@ -2903,7 +2973,7 @@
           // If validating, then insure that its legal to have no content
           if (fValidate)
           {
  -            const int res = fValidator->checkContent(elemDecl->getId(), 0, 0);
  +            const int res = fValidator->checkContent(elemDecl, 0, 0);
               if (res >= 0)
               {
                   fValidator->emitError
  
  
  
  1.15      +36 -11    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.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- XMLScanner.hpp	2001/04/19 18:16:59	1.14
  +++ XMLScanner.hpp	2001/05/03 19:09:09	1.15
  @@ -56,6 +56,11 @@
   
   /*
    * $Log: XMLScanner.hpp,v $
  + * Revision 1.15  2001/05/03 19:09:09  knoaman
  + * Support Warning/Error/FatalError messaging.
  + * Validity constraints errors are treated as errors, with the ability by user to set
  + * validity constraints as fatal errors.
  + *
    * Revision 1.14  2001/04/19 18:16:59  tng
    * Schema: SchemaValidator update, and use QName in Content Model
    *
  @@ -266,6 +271,7 @@
       const XMLErrorReporter* getErrorReporter() const;
       XMLErrorReporter* getErrorReporter();
       bool getExitOnFirstFatal() const;
  +    bool getValidationConstraintFatal() const;
       RefHashTableOf<XMLRefInfo>& getIDRefList();
       bool getInException() const;
       const RefHashTableOf<XMLRefInfo>& getIDRefList() const;
  @@ -293,6 +299,8 @@
           const   XMLCh* const    entName
       );
       NameIdPoolEnumerator<DTDEntityDecl> getEntityEnumerator() const;
  +    const XMLStringPool* getURIStringPool() const;
  +    XMLStringPool* getURIStringPool();
   
       // -----------------------------------------------------------------------
       //  Getter methods
  @@ -374,6 +382,7 @@
       void setErrorReporter(XMLErrorReporter* const errHandler);
       void setErrorHandler(ErrorHandler* const handler);
       void setExitOnFirstFatal(const bool newValue);
  +    void setValidationConstraintFatal(const bool newValue);
       void setValidationScheme(const ValSchemes newScheme);
       void setValidator(XMLValidator* const valToAdopt);
       void setDoSchema(const bool doSchema);
  @@ -457,7 +466,7 @@
       void commonInit();
       void initValidator();
       void resetEntityDeclPool();
  -    void resetURIPool();
  +    void resetURIStringPool();
   
   
       // -----------------------------------------------------------------------
  @@ -509,20 +518,12 @@
           const   XMLCh* const    attrName
           , const XMLCh* const    attrValue
       );
  -    void validateAttrValue
  -    (
  -        const   XMLCh* const            valueText
  -        , const XMLAttDef::AttTypes     type
  -        , const XMLAttDef::DefAttTypes  defType
  -        , const XMLCh* const            defText
  -        , const XMLCh* const            fullName
  -        , const XMLCh* const            enumList
  -    );
       void scanRawAttrListforNameSpaces(const RefVectorOf<KVStringPair>* theRawAttrList, int attCount);
       void parseSchemaLocation(const XMLCh* const schemaLocationStr);
       void resolveSchemaGrammar(const XMLCh* const loc, const XMLCh* const uri);
       bool switchGrammar(int newGrammarNameSpaceIndex);
       bool switchGrammar(const XMLCh* const newGrammarNameSpace);
  +    bool laxElementValidation(QName* element, ContentLeafNameTypeVector* cv);
   
       // -----------------------------------------------------------------------
       //  Private scanning methods
  @@ -626,6 +627,10 @@
       //      or not. It defaults to true, which is the strict XML way, but it
       //      can be changed.
       //
  +    //  fValidationConstraintFatal
  +    //      This indicates whether we treat validation constraint errors as
  +    //      fatal errors or not. It defaults to false, but it can be changed.
  +    //
       //  fIDRefList
       //      This is a list of XMLRefInfo objects. This member lets us do all
       //      needed ID-IDREF balancing checks.
  @@ -739,6 +744,7 @@
       XMLErrorReporter*           fErrorReporter;
       ErrorHandler*               fErrorHandler;
       bool                        fExitOnFirstFatal;
  +    bool                        fValidationConstraintFatal;
       RefHashTableOf<XMLRefInfo>* fIDRefList;
       bool                        fInException;
       RefVectorOf<KVStringPair>*  fRawAttrList;
  @@ -827,6 +833,11 @@
       return fExitOnFirstFatal;
   }
   
  +inline bool XMLScanner::getValidationConstraintFatal() const
  +{
  +    return fValidationConstraintFatal;
  +}
  +
   inline RefHashTableOf<XMLRefInfo>& XMLScanner::getIDRefList()
   {
       return *fIDRefList;
  @@ -917,6 +928,17 @@
   {
       return fEntityDeclPool->getByKey(entName);
   }
  +
  +inline const XMLStringPool* XMLScanner::getURIStringPool() const
  +{
  +    return fURIStringPool;
  +}
  +
  +inline XMLStringPool* XMLScanner::getURIStringPool()
  +{
  +    return fURIStringPool;
  +}
  +
   // ---------------------------------------------------------------------------
   //  XMLScanner: Setter methods
   // ---------------------------------------------------------------------------
  @@ -936,7 +958,7 @@
       if (fDoNamespaces) {
           if (!fURIStringPool) {
               fURIStringPool = new XMLStringPool();
  -            resetURIPool();
  +            resetURIStringPool();
           }
       }
   }
  @@ -965,6 +987,11 @@
   inline void XMLScanner::setExitOnFirstFatal(const bool newValue)
   {
       fExitOnFirstFatal = newValue;
  +}
  +
  +inline void XMLScanner::setValidationConstraintFatal(const bool newValue)
  +{
  +    fValidationConstraintFatal = newValue;
   }
   
   inline void XMLScanner::setValidationScheme(const ValSchemes newScheme)
  
  
  
  1.46      +11 -1     xml-xerces/c/src/parsers/DOMParser.cpp
  
  Index: DOMParser.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/parsers/DOMParser.cpp,v
  retrieving revision 1.45
  retrieving revision 1.46
  diff -u -r1.45 -r1.46
  --- DOMParser.cpp	2001/04/19 18:17:06	1.45
  +++ DOMParser.cpp	2001/05/03 19:09:16	1.46
  @@ -59,7 +59,7 @@
   *  handler with the scanner. In these handler methods, appropriate DOM nodes
   *  are created and added to the DOM tree.
   *
  -* $Id: DOMParser.cpp,v 1.45 2001/04/19 18:17:06 tng Exp $
  +* $Id: DOMParser.cpp,v 1.46 2001/05/03 19:09:16 knoaman Exp $
   *
   */
   
  @@ -164,6 +164,11 @@
       return fScanner->getExitOnFirstFatal();
   }
   
  +bool DOMParser::getValidationConstraintFatal() const
  +{
  +    return fScanner->getValidationConstraintFatal();
  +}
  +
   DOMParser::ValSchemes DOMParser::getValidationScheme() const
   {
       const XMLScanner::ValSchemes scheme = fScanner->getValidationScheme();
  @@ -219,6 +224,11 @@
   void DOMParser::setExitOnFirstFatalError(const bool newState)
   {
       fScanner->setExitOnFirstFatal(newState);
  +}
  +
  +void DOMParser::setValidationConstraintFatal(const bool newState)
  +{
  +    fScanner->setValidationConstraintFatal(newState);
   }
   
   void DOMParser::setValidationScheme(const ValSchemes newScheme)
  
  
  
  1.20      +31 -1     xml-xerces/c/src/parsers/DOMParser.hpp
  
  Index: DOMParser.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/parsers/DOMParser.hpp,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- DOMParser.hpp	2001/03/30 16:46:57	1.19
  +++ DOMParser.hpp	2001/05/03 19:09:20	1.20
  @@ -55,7 +55,7 @@
    */
   
   /*
  - * $Id: DOMParser.hpp,v 1.19 2001/03/30 16:46:57 tng Exp $
  + * $Id: DOMParser.hpp,v 1.20 2001/05/03 19:09:20 knoaman Exp $
    *
    */
   
  @@ -260,6 +260,19 @@
         */
       bool getExitOnFirstFatalError() const;
   
  +    /**
  +      * This method returns the state of the parser's
  +      * validation-constraint-fatal flag.
  +      *
  +      * @return true, if the parser is currently configured to
  +      *         set validation constraint errors as fatal, false 
  +      *         otherwise.
  +      *
  +      * @see #setValidationContraintFatal
  +      */
  +    bool getValidationConstraintFatal() const;
  +    //@}
  +
       /** Get the 'expand entity references' flag.
         * DEPRECATED Use getCreateEntityReferenceNodes() instead.
         *
  @@ -395,6 +408,23 @@
         * @see #getExitOnFirstFatalError
         */
       void setExitOnFirstFatalError(const bool newState);
  +
  +    /**
  +      * This method allows users to set the parser's behaviour when it
  +      * encounters a validtion constraint error. If set to true, and the
  +      * the parser is set to exit when it encounter the first fatal error, 
  +      * the parser will exit at the first encounter. If false, then it will
  +      * report the error and continue processing.
  +      *
  +      * <p>The default value is 'false'.</p>
  +      *
  +      * @param newState The value specifying whether the parser should
  +      *                 continue or exit when it encounters a validation
  +      *                 constraint error.
  +      *
  +      * @see #getValidationConstraintFatal
  +      */
  +    void setValidationConstraintFatal(const bool newState);
   
       /** Set the 'expand entity references' flag
         *
  
  
  
  1.18      +26 -4     xml-xerces/c/src/parsers/SAXParser.cpp
  
  Index: SAXParser.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/parsers/SAXParser.cpp,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- SAXParser.cpp	2001/03/30 16:46:57	1.17
  +++ SAXParser.cpp	2001/05/03 19:09:23	1.18
  @@ -56,6 +56,11 @@
   
   /*
    * $Log: SAXParser.cpp,v $
  + * Revision 1.18  2001/05/03 19:09:23  knoaman
  + * Support Warning/Error/FatalError messaging.
  + * Validity constraints errors are treated as errors, with the ability by user to set
  + * validity constraints as fatal errors.
  + *
    * Revision 1.17  2001/03/30 16:46:57  tng
    * Schema: Use setDoSchema instead of setSchemaValidation which makes more sense.
    *
  @@ -285,6 +290,11 @@
       return fScanner->getExitOnFirstFatal();
   }
   
  +bool SAXParser::getValidationConstraintFatal() const
  +{
  +    return fScanner->getValidationConstraintFatal();
  +}
  +
   
   SAXParser::ValSchemes SAXParser::getValidationScheme() const
   {
  @@ -319,6 +329,12 @@
   }
   
   
  +void SAXParser::setValidationConstraintFatal(const bool newState)
  +{
  +    fScanner->setValidationConstraintFatal(newState);
  +}
  +
  +
   void SAXParser::setValidationScheme(const ValSchemes newScheme)
   {
       if (newScheme == Val_Never)
  @@ -439,20 +455,28 @@
       //  error reporter on the scanner.
       //
       fErrorHandler = handler;
  -    if (fErrorHandler)
  +    if (fErrorHandler) {
           fScanner->setErrorReporter(this);
  -     else
  +        fScanner->setErrorHandler(fErrorHandler);
  +    }
  +    else {
           fScanner->setErrorReporter(0);
  +        fScanner->setErrorHandler(0);
  +    }
   }
   
   
   void SAXParser::setEntityResolver(EntityResolver* const resolver)
   {
       fEntityResolver = resolver;
  -    if (fEntityResolver)
  +    if (fEntityResolver) {
           fScanner->setEntityHandler(this);
  -    else
  +        fScanner->setEntityResolver(fEntityResolver);
  +    }
  +    else {
           fScanner->setEntityHandler(0);
  +        fScanner->setEntityResolver(0);
  +    }
   }
   
   
  
  
  
  1.14      +32 -0     xml-xerces/c/src/parsers/SAXParser.hpp
  
  Index: SAXParser.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/parsers/SAXParser.hpp,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- SAXParser.hpp	2001/03/30 16:46:57	1.13
  +++ SAXParser.hpp	2001/05/03 19:09:25	1.14
  @@ -56,6 +56,11 @@
   
   /*
    * $Log: SAXParser.hpp,v $
  + * Revision 1.14  2001/05/03 19:09:25  knoaman
  + * Support Warning/Error/FatalError messaging.
  + * Validity constraints errors are treated as errors, with the ability by user to set
  + * validity constraints as fatal errors.
  + *
    * Revision 1.13  2001/03/30 16:46:57  tng
    * Schema: Use setDoSchema instead of setSchemaValidation which makes more sense.
    *
  @@ -284,6 +289,18 @@
         * @see #setExitOnFirstFatalError
         */
       bool getExitOnFirstFatalError() const;
  +
  +    /**
  +      * This method returns the state of the parser's
  +      * validation-constraint-fatal flag.
  +      *
  +      * @return true, if the parser is currently configured to
  +      *         set validation constraint errors as fatal, false 
  +      *         otherwise.
  +      *
  +      * @see #setValidationContraintFatal
  +      */
  +    bool getValidationConstraintFatal() const;
       //@}
   
   
  @@ -362,6 +379,23 @@
         * @see #getExitOnFirstFatalError
         */
       void setExitOnFirstFatalError(const bool newState);
  +
  +    /**
  +      * This method allows users to set the parser's behaviour when it
  +      * encounters a validtion constraint error. If set to true, and the
  +      * the parser is set to exit when it encounter the first fatal error, 
  +      * the parser will exit at the first encounter. If false, then it will
  +      * report the error and continue processing.
  +      *
  +      * <p>The default value is 'false'.</p>
  +      *
  +      * @param newState The value specifying whether the parser should
  +      *                 continue or exit when it encounters a validation
  +      *                 constraint error.
  +      *
  +      * @see #getValidationConstraintFatal
  +      */
  +    void setValidationConstraintFatal(const bool newState);
       //@}
   
   
  
  
  
  1.8       +18 -18    xml-xerces/c/tools/NLS/Xlat/Xlat.cpp
  
  Index: Xlat.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/tools/NLS/Xlat/Xlat.cpp,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- Xlat.cpp	2000/03/18 00:00:58	1.7
  +++ Xlat.cpp	2001/05/03 19:09:36	1.8
  @@ -57,6 +57,11 @@
   
   /*
    * $Log: Xlat.cpp,v $
  + * Revision 1.8  2001/05/03 19:09:36  knoaman
  + * Support Warning/Error/FatalError messaging.
  + * Validity constraints errors are treated as errors, with the ability by user to set
  + * validity constraints as fatal errors.
  + *
    * Revision 1.7  2000/03/18 00:00:58  roddey
    * Improved error reporting
    *
  @@ -129,7 +134,7 @@
   {
       L"W_"
       , L"E_"
  -    , L"V_"
  +    , L"F_"
   };
   
   
  @@ -597,21 +602,18 @@
                       typeGotten[0] = true;
                   }
                    else if (typeName.equals(L"Error"))
  +                {
  +                    type = MsgType_Error;
  +                    typeGotten[1] = true;
  +                }
  +                 else if (typeName.equals(L"FatalError"))
                   {
  -                    if (!XMLString::compareString(domainStr.rawBuffer(), XMLUni::fgValidityDomain))
  -                    {
  -                        type = MsgType_Validity;
  -                        typeGotten[2] = true;
  -                    }
  -                     else
  -                    {
  -                        type = MsgType_Error;
  -                        typeGotten[1] = true;
  -                    }
  +                    type = MsgType_FatalError;
  +                    typeGotten[2] = true;
                   }
                    else
                   {
  -                    wprintf(L"Expected a Warning or Errornode\n\n");
  +                    wprintf(L"Expected a Warning, Error, or FatalError node\n\n");
                       throw ErrReturn_SrcFmtError;
                   }
   
  @@ -680,7 +682,7 @@
                       outHeader
                       , L"    static bool isFatal(const %s::Codes toCheck)\n"
                         L"    {\n"
  -                      L"        return ((toCheck >= E_LowBounds) && (toCheck <= E_HighBounds));\n"
  +                      L"        return ((toCheck >= F_LowBounds) && (toCheck <= F_HighBounds));\n"
                         L"    }\n\n"
                       , errNameSpace
                   );
  @@ -698,9 +700,9 @@
                   fwprintf
                   (
                       outHeader
  -                    , L"    static bool isValid(const %s::Codes toCheck)\n"
  +                    , L"    static bool isError(const %s::Codes toCheck)\n"
                         L"    {\n"
  -                      L"        return ((toCheck >= V_LowBounds) && (toCheck <= V_HighBounds));\n"
  +                      L"        return ((toCheck >= E_LowBounds) && (toCheck <= E_HighBounds));\n"
                         L"    }\n\n"
                       , errNameSpace
                   );
  @@ -712,10 +714,10 @@
                         L"    {\n"
                         L"       if ((toCheck >= W_LowBounds) && (toCheck <= W_HighBounds))\n"
                         L"           return XMLErrorReporter::ErrType_Warning;\n"
  -                      L"       else if ((toCheck >= E_LowBounds) && (toCheck <= E_HighBounds))\n"
  +                      L"       else if ((toCheck >= F_LowBounds) && (toCheck <= F_HighBounds))\n"
                         L"            return XMLErrorReporter::ErrType_Fatal;\n"
  -                      L"       else if ((toCheck >= V_LowBounds) && (toCheck <= V_HighBounds))\n"
  -                      L"            return XMLErrorReporter::ErrType_Invalid;\n"
  +                      L"       else if ((toCheck >= E_LowBounds) && (toCheck <= E_HighBounds))\n"
  +                      L"            return XMLErrorReporter::ErrType_Error;\n"
                         L"       return XMLErrorReporter::ErrTypes_Unknown;\n"
                         L"    }\n"
                       , errNameSpace
  
  
  
  1.4       +6 -1      xml-xerces/c/tools/NLS/Xlat/Xlat.hpp
  
  Index: Xlat.hpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/tools/NLS/Xlat/Xlat.hpp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Xlat.hpp	2000/03/02 19:55:53	1.3
  +++ Xlat.hpp	2001/05/03 19:09:38	1.4
  @@ -56,6 +56,11 @@
   
   /*
    * $Log: Xlat.hpp,v $
  + * Revision 1.4  2001/05/03 19:09:38  knoaman
  + * Support Warning/Error/FatalError messaging.
  + * Validity constraints errors are treated as errors, with the ability by user to set
  + * validity constraints as fatal errors.
  + *
    * Revision 1.3  2000/03/02 19:55:53  roddey
    * This checkin includes many changes done while waiting for the
    * 1.1.0 code to be finished. I can't list them all here, but a list is
  @@ -80,7 +85,7 @@
   {
       MsgType_Warning
       , MsgType_Error
  -    , MsgType_Validity
  +    , MsgType_FatalError
   
       , MsgTypes_Count
   };
  
  
  

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