diff --git a/src/xercesc/internal/IGXMLScanner.cpp b/src/xercesc/internal/IGXMLScanner.cpp
index 05f382c476f057cc25068924cddb4abb782fd768..04e1e57e375b184ce7729cf1f5a5caee76d798b7 100644
--- a/src/xercesc/internal/IGXMLScanner.cpp
+++ b/src/xercesc/internal/IGXMLScanner.cpp
@@ -2786,11 +2786,6 @@ bool IGXMLScanner::scanStartTagNS(bool& gotData)
             if(fGrammarType == Grammar::SchemaGrammarType)
             {
                 ((SchemaElementDecl *)(elemDecl))->setValidity(PSVIDefs::INVALID);
-                if (getPSVIHandler())
-                {
-                    // REVISIT:                
-                    // PSVIElement->setValidity(PSVIItem::VALIDITY_INVALID);
-                }
             }
         }
     }
diff --git a/src/xercesc/internal/IGXMLScanner2.cpp b/src/xercesc/internal/IGXMLScanner2.cpp
index 1169bfa9ccde06e363d8a55d54169cc955140ccf..1bc6846e86291d9f998e362ce7e0363c51041acf 100644
--- a/src/xercesc/internal/IGXMLScanner2.cpp
+++ b/src/xercesc/internal/IGXMLScanner2.cpp
@@ -124,7 +124,7 @@ IGXMLScanner::buildAttList(const  RefVectorOf<KVStringPair>&  providedAttrs
     // know what's best.  REVISIT:  don't modify grammar at all; eliminate
     // this step...
     ComplexTypeInfo *currType = 0;
-    if(fGrammar->getGrammarType() == Grammar::SchemaGrammarType)
+    if(fGrammar->getGrammarType() == Grammar::SchemaGrammarType && fValidate)
         currType = ((SchemaValidator*)fValidator)->getCurrentTypeInfo();
     const bool hasDefs = (currType && fValidate)
             ? currType->resetDefs()
@@ -245,11 +245,14 @@ IGXMLScanner::buildAttList(const  RefVectorOf<KVStringPair>&  providedAttrs
                         //if schema, see if we should lax or skip the validation of this attribute
                         if (anyAttributeValidation(attWildCard, uriId, skipThisOne, laxThisOne)) {
 
-                            SchemaGrammar* sGrammar = (SchemaGrammar*) fGrammarResolver->getGrammar(getURIText(uriId));
-                            if (sGrammar && sGrammar->getGrammarType() == Grammar::SchemaGrammarType) {
-                                RefHashTableOf<XMLAttDef>* attRegistry = sGrammar->getAttributeDeclRegistry();
-                                if (attRegistry) {
-                                    attDefForWildCard = attRegistry->get(suffPtr);
+                            if(!skipThisOne)
+                            {
+                                SchemaGrammar* sGrammar = (SchemaGrammar*) fGrammarResolver->getGrammar(getURIText(uriId));
+                                if (sGrammar && sGrammar->getGrammarType() == Grammar::SchemaGrammarType) {
+                                    RefHashTableOf<XMLAttDef>* attRegistry = sGrammar->getAttributeDeclRegistry();
+                                    if (attRegistry) {
+                                        attDefForWildCard = attRegistry->get(suffPtr);
+                                    }
                                 }
                             }
                         }
@@ -307,10 +310,9 @@ IGXMLScanner::buildAttList(const  RefVectorOf<KVStringPair>&  providedAttrs
             //  Find this attribute within the parent element. We pass both
             //  the uriID/name and the raw QName buffer, since we don't know
             //  how the derived validator and its elements store attributes.
-            if (!attDef) {
-                if(fGrammarType == Grammar::SchemaGrammarType) 
-                    attDef = ((SchemaElementDecl *)elemDecl)->getAttDef( suffPtr , uriId);
-                else 
+            else
+            {
+                if(fGrammarType == Grammar::DTDGrammarType) 
                     attDef = ((DTDElementDecl *)elemDecl)->getAttDef ( namePtr);
             } 
 
@@ -484,7 +486,7 @@ IGXMLScanner::buildAttList(const  RefVectorOf<KVStringPair>&  providedAttrs
                     }
                 }
 
-                if (fValidate && !skipThisOne) {
+                if (fValidate ) {
                     fValidator->validateAttrValue
                     (
                         attDefForWildCard
diff --git a/src/xercesc/internal/SGXMLScanner.cpp b/src/xercesc/internal/SGXMLScanner.cpp
index dea53b1636bf3b8a4fb1a35e057dac4588959462..b4380c44d5ec8ce4d2cdee96523b44d7c3bd8ec7 100644
--- a/src/xercesc/internal/SGXMLScanner.cpp
+++ b/src/xercesc/internal/SGXMLScanner.cpp
@@ -2272,7 +2272,9 @@ SGXMLScanner::buildAttList(const  RefVectorOf<KVStringPair>&  providedAttrs
     //  Ask the element to clear the 'provided' flag on all of the att defs
     //  that it owns, and to return us a boolean indicating whether it has
     //  any defs.
-    ComplexTypeInfo *currType = ((SchemaValidator*)fValidator)->getCurrentTypeInfo();
+    ComplexTypeInfo *currType = (fValidate)
+                ?((SchemaValidator*)fValidator)->getCurrentTypeInfo()
+                :0;
     const bool hasDefs = (currType && fValidate) 
             ? currType->resetDefs()
             : elemDecl->resetDefs();
@@ -2391,11 +2393,14 @@ SGXMLScanner::buildAttList(const  RefVectorOf<KVStringPair>&  providedAttrs
                         //if schema, see if we should lax or skip the validation of this attribute
                         if (anyAttributeValidation(attWildCard, uriId, skipThisOne, laxThisOne)) {
 
-                            SchemaGrammar* sGrammar = (SchemaGrammar*) fGrammarResolver->getGrammar(getURIText(uriId));
-                            if (sGrammar && sGrammar->getGrammarType() == Grammar::SchemaGrammarType) {
-                                RefHashTableOf<XMLAttDef>* attRegistry = sGrammar->getAttributeDeclRegistry();
-                                if (attRegistry) {
-                                    attDefForWildCard = attRegistry->get(suffPtr);
+                            if(!skipThisOne)
+                            {
+                                SchemaGrammar* sGrammar = (SchemaGrammar*) fGrammarResolver->getGrammar(getURIText(uriId));
+                                if (sGrammar && sGrammar->getGrammarType() == Grammar::SchemaGrammarType) {
+                                    RefHashTableOf<XMLAttDef>* attRegistry = sGrammar->getAttributeDeclRegistry();
+                                    if (attRegistry) {
+                                        attDefForWildCard = attRegistry->get(suffPtr);
+                                    }
                                 }
                             }
                         }
@@ -2444,13 +2449,6 @@ SGXMLScanner::buildAttList(const  RefVectorOf<KVStringPair>&  providedAttrs
                 }
             }
 
-            //  Find this attribute within the parent element. We pass both
-            //  the uriID/name and the raw QName buffer, since we don't know
-            //  how the derived validator and its elements store attributes.
-            if (!attDef) {
-                attDef = ((SchemaElementDecl *)elemDecl)->getAttDef(suffPtr, uriId);
-            }
-
             // now need to prepare for duplicate detection
             if(attDef)
             {
@@ -2595,7 +2593,7 @@ SGXMLScanner::buildAttList(const  RefVectorOf<KVStringPair>&  providedAttrs
                     }
                 }
 
-                if (fValidate && !skipThisOne) {
+                if (fValidate ) {
                     fValidator->validateAttrValue
                     (
                         attDefForWildCard