diff --git a/src/xercesc/validators/common/DFAContentModel.cpp b/src/xercesc/validators/common/DFAContentModel.cpp
index 789c9e0f24683dd4dfeb675512eed3d131209a8d..6dd132025df12e777ceffbbd32284f73c57114df 100644
--- a/src/xercesc/validators/common/DFAContentModel.cpp
+++ b/src/xercesc/validators/common/DFAContentModel.cpp
@@ -56,8 +56,11 @@
 
 /*
  * $Log$
- * Revision 1.1  2002/02/01 22:22:38  peiyongz
- * Initial revision
+ * Revision 1.2  2002/02/25 21:18:53  tng
+ * Schema Fix: Ensure no invalid uri index for UPA checking.
+ *
+ * Revision 1.1.1.1  2002/02/01 22:22:38  peiyongz
+ * sane_include
  *
  * Revision 1.29  2001/12/10 21:42:55  peiyongz
  * Memory Leak: fLeafNameTypeVector
@@ -1192,7 +1195,10 @@ void DFAContentModel::checkUniqueParticleAttribution (SchemaGrammar*    const pG
 
         unsigned int orgURIIndex = fElemMap[i]->getURI();
 
-        if (orgURIIndex != XMLContentModel::gEOCFakeId) {
+        if ((orgURIIndex != XMLContentModel::gEOCFakeId) &&
+            (orgURIIndex != XMLContentModel::gEpsilonFakeId) &&
+            (orgURIIndex != XMLElementDecl::fgInvalidElemId) &&
+            (orgURIIndex != XMLElementDecl::fgPCDataElemId)) {
             fElemMap[i]->setURI(pContentSpecOrgURI[orgURIIndex]);
         }
     }
diff --git a/src/xercesc/validators/common/MixedContentModel.hpp b/src/xercesc/validators/common/MixedContentModel.hpp
index 186bf5efbb02caccc4da986a6997c2c696ca6efe..978d9abf82f0f37ab2533c67e95d1bc7fd085e3b 100644
--- a/src/xercesc/validators/common/MixedContentModel.hpp
+++ b/src/xercesc/validators/common/MixedContentModel.hpp
@@ -56,8 +56,11 @@
 
 /*
  * $Log$
- * Revision 1.1  2002/02/01 22:22:39  peiyongz
- * Initial revision
+ * Revision 1.2  2002/02/25 21:18:53  tng
+ * Schema Fix: Ensure no invalid uri index for UPA checking.
+ *
+ * Revision 1.1.1.1  2002/02/01 22:22:39  peiyongz
+ * sane_include
  *
  * Revision 1.12  2001/11/28 16:46:20  tng
  * Schema fix: Check for invalid URI index first.
@@ -260,7 +263,9 @@ inline void MixedContentModel::checkUniqueParticleAttribution
     unsigned int i = 0;
     for (i = 0; i < fCount; i++) {
         unsigned int orgURIIndex = fChildren[i]->getURI();
-        if (orgURIIndex != XMLContentModel::gEOCFakeId)
+        if ((orgURIIndex != XMLContentModel::gEOCFakeId) &&
+            (orgURIIndex != XMLElementDecl::fgInvalidElemId) &&
+            (orgURIIndex != XMLElementDecl::fgPCDataElemId))
             fChildren[i]->setURI(pContentSpecOrgURI[orgURIIndex]);
     }
 
diff --git a/src/xercesc/validators/common/SimpleContentModel.cpp b/src/xercesc/validators/common/SimpleContentModel.cpp
index 3bbb1c31bb48f7f151d05cbc49e947aeeb89832e..5038d80dd3fa5ed4031ad375cc727f1ee8cf004f 100644
--- a/src/xercesc/validators/common/SimpleContentModel.cpp
+++ b/src/xercesc/validators/common/SimpleContentModel.cpp
@@ -56,8 +56,11 @@
 
 /*
  * $Log$
- * Revision 1.1  2002/02/01 22:22:39  peiyongz
- * Initial revision
+ * Revision 1.2  2002/02/25 21:18:53  tng
+ * Schema Fix: Ensure no invalid uri index for UPA checking.
+ *
+ * Revision 1.1.1.1  2002/02/01 22:22:39  peiyongz
+ * sane_include
  *
  * Revision 1.11  2001/11/28 16:46:20  tng
  * Schema fix: Check for invalid URI index first.
@@ -499,11 +502,15 @@ void SimpleContentModel::checkUniqueParticleAttribution
     unsigned int orgURIIndex = 0;
 
     orgURIIndex = fFirstChild->getURI();
-    if (orgURIIndex != XMLContentModel::gEOCFakeId)
+    if ((orgURIIndex != XMLContentModel::gEOCFakeId) &&
+        (orgURIIndex != XMLElementDecl::fgInvalidElemId) &&
+        (orgURIIndex != XMLElementDecl::fgPCDataElemId))
         fFirstChild->setURI(pContentSpecOrgURI[orgURIIndex]);
 
     orgURIIndex = fSecondChild->getURI();
-    if (orgURIIndex != XMLContentModel::gEOCFakeId)
+    if ((orgURIIndex != XMLContentModel::gEOCFakeId) &&
+        (orgURIIndex != XMLElementDecl::fgInvalidElemId) &&
+        (orgURIIndex != XMLElementDecl::fgPCDataElemId))
         fSecondChild->setURI(pContentSpecOrgURI[orgURIIndex]);
 
     // only possible violation is when it's a choice
diff --git a/src/xercesc/validators/schema/SchemaValidator.cpp b/src/xercesc/validators/schema/SchemaValidator.cpp
index 130ff7f9aecded7a77027a29c52c9998c7c1bf44..a4c784f5bb63f1d35b0c8123f4ced315fd1289c2 100644
--- a/src/xercesc/validators/schema/SchemaValidator.cpp
+++ b/src/xercesc/validators/schema/SchemaValidator.cpp
@@ -56,6 +56,9 @@
 
 /*
  * $Log$
+ * Revision 1.3  2002/02/25 21:18:18  tng
+ * Schema Fix: Ensure no invalid uri index for UPA checking.
+ *
  * Revision 1.2  2002/02/07 16:41:29  knoaman
  * Fix for xsi:type.
  *
@@ -482,7 +485,10 @@ void SchemaValidator::validateElement(const   XMLElementDecl*  elemDef)
         unsigned int uri = fXsiType->getURI();
         const XMLCh* localPart = fXsiType->getLocalPart();
 
-        if (uri != XMLElementDecl::fgInvalidElemId || uri != XMLElementDecl::fgPCDataElemId) {
+        if (uri != XMLElementDecl::fgInvalidElemId ||
+            uri != XMLElementDecl::fgPCDataElemId ||
+            uri != XMLContentModel::gEpsilonFakeId ||
+            uri != XMLContentModel::gEOCFakeId) {
             // retrieve Grammar for the uri
             const XMLCh* uriStr = getScanner()->getURIText(uri);
             SchemaGrammar* sGrammar = (SchemaGrammar*) fGrammarResolver->getGrammar(uriStr);
diff --git a/src/xercesc/validators/schema/SubstitutionGroupComparator.cpp b/src/xercesc/validators/schema/SubstitutionGroupComparator.cpp
index c6d19a91db92ecdce44fc5848f5787beae2907e4..4f9de0ba7284e28f33ce8f3887fa744966d61a73 100644
--- a/src/xercesc/validators/schema/SubstitutionGroupComparator.cpp
+++ b/src/xercesc/validators/schema/SubstitutionGroupComparator.cpp
@@ -56,8 +56,11 @@
 
 /*
  * $Log$
- * Revision 1.1  2002/02/01 22:22:47  peiyongz
- * Initial revision
+ * Revision 1.2  2002/02/25 21:18:18  tng
+ * Schema Fix: Ensure no invalid uri index for UPA checking.
+ *
+ * Revision 1.1.1.1  2002/02/01 22:22:47  peiyongz
+ * sane_include
  *
  * Revision 1.11  2001/11/28 16:46:03  tng
  * Schema fix: Initialize the temporary string as null terminated.
@@ -124,7 +127,8 @@ bool SubstitutionGroupComparator::isEquivalentTo(QName* const anElement
     unsigned int uriId = anElement->getURI();
     if (uriId == XMLContentModel::gEOCFakeId ||
         uriId == XMLContentModel::gEpsilonFakeId ||
-        uriId == XMLElementDecl::fgPCDataElemId)
+        uriId == XMLElementDecl::fgPCDataElemId ||
+        uriId == XMLElementDecl::fgInvalidElemId)
         return false;
 
     const XMLCh* uri = fStringPool->getValueForId(uriId);
@@ -241,7 +245,12 @@ bool SubstitutionGroupComparator::isAllowedByWildcard(SchemaGrammar* const pGram
     unsigned int uriId = element->getURI();
 
     if ((!wother && uriId == wuri) ||
-        (wother && uriId != wuri && uriId != XMLContentModel::gEOCFakeId && uriId != XMLContentModel::gEpsilonFakeId))
+        (wother &&
+         uriId != wuri &&
+         uriId != XMLContentModel::gEOCFakeId &&
+         uriId != XMLContentModel::gEpsilonFakeId &&
+         uriId != XMLElementDecl::fgPCDataElemId &&
+         uriId != XMLElementDecl::fgInvalidElemId))
     {
         return true;
     }
@@ -265,7 +274,12 @@ bool SubstitutionGroupComparator::isAllowedByWildcard(SchemaGrammar* const pGram
         unsigned int subUriId = subsElements->elementAt(i)->getElementName()->getURI();
 
         if ((!wother && subUriId == wuri) ||
-            (wother && subUriId != wuri && subUriId != XMLContentModel::gEOCFakeId && subUriId != XMLContentModel::gEpsilonFakeId))
+            (wother &&
+             subUriId != wuri &&
+             subUriId != XMLContentModel::gEOCFakeId &&
+             subUriId != XMLContentModel::gEpsilonFakeId &&
+             subUriId != XMLElementDecl::fgPCDataElemId &&
+             subUriId != XMLElementDecl::fgInvalidElemId))
         {
             return true;
         }