knoaman     2003/02/05 09:08:43

  Modified:    c/src/xercesc/internal DGXMLScanner.cpp IGXMLScanner2.cpp
                        SGXMLScanner.cpp
  Log:
  [Bug 16747] Parser loses ValidationScheme setting between parse attempts
  
  Revision  Changes    Path
  1.7       +3 -4      xml-xerces/c/src/xercesc/internal/DGXMLScanner.cpp
  
  Index: DGXMLScanner.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/internal/DGXMLScanner.cpp,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- DGXMLScanner.cpp  4 Feb 2003 21:21:19 -0000       1.6
  +++ DGXMLScanner.cpp  5 Feb 2003 17:08:42 -0000       1.7
  @@ -1998,9 +1998,8 @@
       fRootGrammar = 0;
       fValidator->setGrammar(fGrammar);
   
  -    if (fValScheme == Val_Auto) {
  -        fValidate = false;
  -    }
  +    // Reset validation
  +    fValidate = (fValScheme == Val_Always) ? true : false;
   
       //  And for all installed handlers, send reset events. This gives them
       //  a chance to flush any cached data.
  
  
  
  1.13      +13 -14    xml-xerces/c/src/xercesc/internal/IGXMLScanner2.cpp
  
  Index: IGXMLScanner2.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/internal/IGXMLScanner2.cpp,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- IGXMLScanner2.cpp 4 Feb 2003 21:21:50 -0000       1.12
  +++ IGXMLScanner2.cpp 5 Feb 2003 17:08:42 -0000       1.13
  @@ -281,7 +281,7 @@
                   //we may have set it to invalid already, but this is the first time 
we are guarenteed to have the attDef
                   if(((SchemaAttDef *)(attDef))->getValidity() != PSVIDefs::INVALID)
                       ((SchemaAttDef *)(attDef))->setValidity(PSVIDefs::VALID);
  -
  +                    
                   ((SchemaAttDef *)(attDef))->setValidationAttempted(PSVIDefs::FULL);
               }
   
  @@ -292,7 +292,7 @@
                   attDef->setCreateReason(XMLAttDef::JustFaultIn);
               }
   
  -            bool errorCondition = fValidate && !attDefForWildCard &&
  +            bool errorCondition = fValidate && !attDefForWildCard && 
                   attDef->getCreateReason() == XMLAttDef::JustFaultIn && 
!attDef->getProvided();
               if (errorCondition && !skipThisOne && !laxThisOne)
               {
  @@ -334,7 +334,7 @@
               if (attDef->getProvided())
               {
                   emitError
  -                (
  +                ( 
                       XMLErrs::AttrAlreadyUsedInSTag
                       , attDef->getFullName()
                       , elemDecl->getFullName()
  @@ -517,7 +517,7 @@
                               XMLValid::RequiredAttrNotProvided
                               , curDef->getFullName()
                           );
  -                        if(fGrammarType == Grammar::SchemaGrammarType)
  +                        if(fGrammarType == Grammar::SchemaGrammarType) 
                               ((SchemaAttDef 
*)(curDef))->setValidity(PSVIDefs::INVALID);
                       }
                       else if ((defType == XMLAttDef::Default) ||
  @@ -527,7 +527,7 @@
                           {
                               // XML 1.0 Section 2.9
                               // Document is standalone, so attributes must not be 
defaulted.
  -                            fValidator->emitError(XMLValid::NoDefAttForStandalone, 
curDef->getFullName(), elemDecl->getFullName());
  +                            fValidator->emitError(XMLValid::NoDefAttForStandalone, 
curDef->getFullName(), elemDecl->getFullName());                                       
                 
                               if(fGrammarType == Grammar::SchemaGrammarType)
                                   ((SchemaAttDef 
*)(curDef))->setValidity(PSVIDefs::INVALID);
                           }
  @@ -883,9 +883,8 @@
           fValidator->setGrammar(fGrammar);
       }
   
  -    if (fValScheme == Val_Auto) {
  -        fValidate = false;
  -    }
  +    // Reset validation
  +    fValidate = (fValScheme == Val_Always) ? true : false;
   
       //  And for all installed handlers, send reset events. This gives them
       //  a chance to flush any cached data.
  @@ -993,7 +992,7 @@
           {
               // They definitely cannot handle any type of char data
               fValidator->emitError(XMLValid::NoCharDataInCM);
  -            if(fGrammarType == Grammar::SchemaGrammarType)
  +            if(fGrammarType == Grammar::SchemaGrammarType) 
                   ((SchemaElementDecl 
*)topElem->fThisElement)->setValidity(PSVIDefs::INVALID);
           }
           else if (fReaderMgr.getCurrentReader()->isAllSpaces(rawBuf, len))
  @@ -1086,7 +1085,7 @@
               else
               {
                   fValidator->emitError(XMLValid::NoCharDataInCM);
  -                if(fGrammarType == Grammar::SchemaGrammarType)
  +                if(fGrammarType == Grammar::SchemaGrammarType) 
                       ((SchemaElementDecl 
*)topElem->fThisElement)->setValidity(PSVIDefs::INVALID);
               }
           }
  @@ -1525,6 +1524,7 @@
       fSchemaValidator->reset();
       fSchemaValidator->setErrorReporter(fErrorReporter);
       fSchemaValidator->setExitOnFirstFatal(fExitOnFirstFatal);
  +    fSchemaValidator->setGrammarResolver(fGrammarResolver);
   
       if (fValidatorFromUser)
           fValidator->reset();
  @@ -2008,7 +2008,6 @@
               // This document is standalone; this ignorable CDATA whitespace is 
forbidden.
               // XML 1.0, Section 2.9
               // And see if the current element is a 'Children' style content model
  -
               if (topElem->fThisElement->isExternal()) {
   
                   if (charOpts == XMLElementDecl::SpacesOk) // Element Content
  @@ -2016,7 +2015,7 @@
                       // Error - standalone should have a value of "no" as whitespace 
detected in an
                       // element type with element content whose element declaration 
was external
                       fValidator->emitError(XMLValid::NoWSForStandalone);
  -                    if(fGrammarType == Grammar::SchemaGrammarType)
  +                    if(fGrammarType == Grammar::SchemaGrammarType) 
                           ((SchemaElementDecl 
*)topElem->fThisElement)->setValidity(PSVIDefs::INVALID);
                   }
               }
  @@ -2331,7 +2330,7 @@
                       // element type with element content whose element declaration 
was external
                       //
                       fValidator->emitError(XMLValid::NoWSForStandalone);
  -                    if(fGrammarType == Grammar::SchemaGrammarType)
  +                    if(fGrammarType == Grammar::SchemaGrammarType) 
                           ((SchemaElementDecl 
*)fElemStack.topElement()->fThisElement)->setValidity(PSVIDefs::INVALID);
                   }
               }
  
  
  
  1.17      +16 -16    xml-xerces/c/src/xercesc/internal/SGXMLScanner.cpp
  
  Index: SGXMLScanner.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xerces/c/src/xercesc/internal/SGXMLScanner.cpp,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- SGXMLScanner.cpp  5 Feb 2003 09:10:10 -0000       1.16
  +++ SGXMLScanner.cpp  5 Feb 2003 17:08:42 -0000       1.17
  @@ -954,7 +954,7 @@
                       , topElem->fThisElement->getFormattedContentModel()
                   );
               }
  -
  +            
           }
   
           // call matchers and de-activate context
  @@ -1206,7 +1206,7 @@
                       ,uriStr
                   );
                   errorBeforeElementFound = true;
  -            }
  +            } 
               else if(errorCondition)
                   laxBeforeElementFound = true;
   
  @@ -1249,7 +1249,7 @@
                       );
                       errorBeforeElementFound = true;
                   }
  -                else if(errorCondition)
  +                else if(errorCondition) 
                       laxBeforeElementFound = true;
   
               }
  @@ -1294,10 +1294,10 @@
                     , XMLUni::fgZeroLenString
                   );
                   errorBeforeElementFound = true;
  -
  +                
               }
               else if(errorCondition)
  -                laxBeforeElementFound = true;
  +                laxBeforeElementFound = true; 
   
               elemDecl = fGrammar->getElemDecl
               (
  @@ -1333,7 +1333,7 @@
                       errorBeforeElementFound = true;
                   }
                   else if(errorCondition)
  -                    laxBeforeElementFound = true;
  +                    laxBeforeElementFound = true; 
   
                   elemDecl = fGrammar->getElemDecl
                              (
  @@ -1411,9 +1411,9 @@
           if (!elemDecl->isDeclared()) {
               if (laxThisOne) {
                   fValidate = false;
  -                fElemStack.setValidationFlag(fValidate);
  +                fElemStack.setValidationFlag(fValidate);                
               }
  -
  +            
               if (fValidate)
                   {
                   fValidator->emitError
  @@ -2093,7 +2093,7 @@
                   //we may have set it to invalid already, but this is the first time 
we are guarenteed to have the attDef
                   if(((SchemaAttDef *)(attDef))->getValidity() != PSVIDefs::INVALID)
                       ((SchemaAttDef *)(attDef))->setValidity(PSVIDefs::VALID);
  -
  +                    
                   ((SchemaAttDef *)(attDef))->setValidationAttempted(PSVIDefs::FULL);
               }
   
  @@ -2104,7 +2104,7 @@
                   attDef->setCreateReason(XMLAttDef::JustFaultIn);
               }
   
  -            bool errorCondition = fValidate && !attDefForWildCard &&
  +            bool errorCondition = fValidate && !attDefForWildCard && 
                   attDef->getCreateReason() == XMLAttDef::JustFaultIn && 
!attDef->getProvided();
               if (errorCondition && !skipThisOne && !laxThisOne)
               {
  @@ -2381,7 +2381,7 @@
                           XMLValid::ProhibitedAttributePresent
                           , curDef->getFullName()
                       );
  -                    ((SchemaAttDef *)curDef)->setValidity(PSVIDefs::INVALID);
  +                    ((SchemaAttDef *)curDef)->setValidity(PSVIDefs::INVALID);       
  
                   }
                   ((SchemaElementDecl 
*)elemDecl)->updateValidityFromAttribute((SchemaAttDef *)curDef);
               }
  @@ -2460,7 +2460,7 @@
                            // Can't have a standalone document declaration of "yes" 
if  attribute
                            // values are subject to normalisation
                            fValidator->emitError(XMLValid::NoAttNormForStandalone, 
attrName);
  -                         ((SchemaAttDef *)attDef)->setValidity(PSVIDefs::INVALID);
  +                         ((SchemaAttDef *)attDef)->setValidity(PSVIDefs::INVALID);  
   
                       }
                       nextCh = chSpace;
                   }
  @@ -2654,9 +2654,8 @@
           ((SchemaValidator*) fValidator)->setExitOnFirstFatal(fExitOnFirstFatal);
       }
   
  -    if (fValScheme == Val_Auto) {
  -        fValidate = false;
  -    }
  +    // Reset validation
  +    fValidate = (fValScheme == Val_Always) ? true : false;
   
       //  And for all installed handlers, send reset events. This gives them
       //  a chance to flush any cached data.
  @@ -3248,6 +3247,7 @@
       fSchemaValidator->reset();
       fSchemaValidator->setErrorReporter(fErrorReporter);
       fSchemaValidator->setExitOnFirstFatal(fExitOnFirstFatal);
  +    fSchemaValidator->setGrammarResolver(fGrammarResolver);
   
       if (fValidatorFromUser)
           fValidator->reset();
  
  
  

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

Reply via email to