diff --git a/src/xercesc/internal/DGXMLScanner.cpp b/src/xercesc/internal/DGXMLScanner.cpp
index 1c2e8a30ac8db78cf5f7bb440110480e5b0e86c4..c1230dd3a2b5e6524f42996701061c403e3b9e80 100644
--- a/src/xercesc/internal/DGXMLScanner.cpp
+++ b/src/xercesc/internal/DGXMLScanner.cpp
@@ -1998,9 +1998,8 @@ void DGXMLScanner::scanReset(const InputSource& src)
     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.
diff --git a/src/xercesc/internal/IGXMLScanner2.cpp b/src/xercesc/internal/IGXMLScanner2.cpp
index 53915c7d4c8378af41dd0f8a56432b37ed531ef7..ba2b21d9002dba14f3f9e355b0f5921f21b08dad 100644
--- a/src/xercesc/internal/IGXMLScanner2.cpp
+++ b/src/xercesc/internal/IGXMLScanner2.cpp
@@ -281,7 +281,7 @@ IGXMLScanner::buildAttList(const  RefVectorOf<KVStringPair>&  providedAttrs
                 //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 @@ IGXMLScanner::buildAttList(const  RefVectorOf<KVStringPair>&  providedAttrs
                 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 @@ IGXMLScanner::buildAttList(const  RefVectorOf<KVStringPair>&  providedAttrs
             if (attDef->getProvided())
             {
                 emitError
-                (
+                ( 
                     XMLErrs::AttrAlreadyUsedInSTag
                     , attDef->getFullName()
                     , elemDecl->getFullName()
@@ -517,7 +517,7 @@ IGXMLScanner::buildAttList(const  RefVectorOf<KVStringPair>&  providedAttrs
                             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 @@ IGXMLScanner::buildAttList(const  RefVectorOf<KVStringPair>&  providedAttrs
                         {
                             // 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 @@ void IGXMLScanner::scanReset(const InputSource& src)
         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 @@ void IGXMLScanner::sendCharData(XMLBuffer& toSend)
         {
             // 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 @@ void IGXMLScanner::sendCharData(XMLBuffer& toSend)
             else
             {
                 fValidator->emitError(XMLValid::NoCharDataInCM);
-                if(fGrammarType == Grammar::SchemaGrammarType)
+                if(fGrammarType == Grammar::SchemaGrammarType) 
                     ((SchemaElementDecl *)topElem->fThisElement)->setValidity(PSVIDefs::INVALID);
             }
         }
@@ -1525,6 +1524,7 @@ Grammar* IGXMLScanner::loadXMLSchemaGrammar(const InputSource& src,
     fSchemaValidator->reset();
     fSchemaValidator->setErrorReporter(fErrorReporter);
     fSchemaValidator->setExitOnFirstFatal(fExitOnFirstFatal);
+    fSchemaValidator->setGrammarResolver(fGrammarResolver);
 
     if (fValidatorFromUser)
         fValidator->reset();
@@ -2008,7 +2008,6 @@ void IGXMLScanner::scanCDSection()
             // 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 @@ void IGXMLScanner::scanCDSection()
                     // 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 @@ void IGXMLScanner::scanCharData(XMLBuffer& toUse)
                     // 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);
                 }
             }
diff --git a/src/xercesc/internal/SGXMLScanner.cpp b/src/xercesc/internal/SGXMLScanner.cpp
index e61672ff4610cf8314fa4d5cdbcb75939a1b18e8..741c96584f518f9e25c4e4257828f765445e2f83 100644
--- a/src/xercesc/internal/SGXMLScanner.cpp
+++ b/src/xercesc/internal/SGXMLScanner.cpp
@@ -954,7 +954,7 @@ void SGXMLScanner::scanEndTag(bool& gotData)
                     , topElem->fThisElement->getFormattedContentModel()
                 );
             }
-
+            
         }
 
         // call matchers and de-activate context
@@ -1206,7 +1206,7 @@ bool SGXMLScanner::scanStartTag(bool& gotData)
                     ,uriStr
                 );
                 errorBeforeElementFound = true;
-            }
+            } 
             else if(errorCondition)
                 laxBeforeElementFound = true;
 
@@ -1249,7 +1249,7 @@ bool SGXMLScanner::scanStartTag(bool& gotData)
                     );
                     errorBeforeElementFound = true;
                 }
-                else if(errorCondition)
+                else if(errorCondition) 
                     laxBeforeElementFound = true;
 
             }
@@ -1294,10 +1294,10 @@ bool SGXMLScanner::scanStartTag(bool& gotData)
                   , XMLUni::fgZeroLenString
                 );
                 errorBeforeElementFound = true;
-
+                
             }
             else if(errorCondition)
-                laxBeforeElementFound = true;
+                laxBeforeElementFound = true; 
 
             elemDecl = fGrammar->getElemDecl
             (
@@ -1333,7 +1333,7 @@ bool SGXMLScanner::scanStartTag(bool& gotData)
                     errorBeforeElementFound = true;
                 }
                 else if(errorCondition)
-                    laxBeforeElementFound = true;
+                    laxBeforeElementFound = true; 
 
                 elemDecl = fGrammar->getElemDecl
                            (
@@ -1411,9 +1411,9 @@ bool SGXMLScanner::scanStartTag(bool& gotData)
         if (!elemDecl->isDeclared()) {
             if (laxThisOne) {
                 fValidate = false;
-                fElemStack.setValidationFlag(fValidate);
+                fElemStack.setValidationFlag(fValidate);                
             }
-
+            
             if (fValidate)
                 {
                 fValidator->emitError
@@ -2093,7 +2093,7 @@ SGXMLScanner::buildAttList(const  RefVectorOf<KVStringPair>&  providedAttrs
                 //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 @@ SGXMLScanner::buildAttList(const  RefVectorOf<KVStringPair>&  providedAttrs
                 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 @@ SGXMLScanner::buildAttList(const  RefVectorOf<KVStringPair>&  providedAttrs
                         XMLValid::ProhibitedAttributePresent
                         , curDef->getFullName()
                     );
-                    ((SchemaAttDef *)curDef)->setValidity(PSVIDefs::INVALID);
+                    ((SchemaAttDef *)curDef)->setValidity(PSVIDefs::INVALID);         
                 }
                 ((SchemaElementDecl *)elemDecl)->updateValidityFromAttribute((SchemaAttDef *)curDef);
             }
@@ -2460,7 +2460,7 @@ bool SGXMLScanner::normalizeAttValue( const   XMLAttDef* const    attDef
                          // 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 @@ void SGXMLScanner::scanReset(const InputSource& src)
         ((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 @@ Grammar* SGXMLScanner::loadXMLSchemaGrammar(const InputSource& src,
     fSchemaValidator->reset();
     fSchemaValidator->setErrorReporter(fErrorReporter);
     fSchemaValidator->setExitOnFirstFatal(fExitOnFirstFatal);
+    fSchemaValidator->setGrammarResolver(fGrammarResolver);
 
     if (fValidatorFromUser)
         fValidator->reset();