You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by bo...@apache.org on 2008/06/24 13:24:11 UTC

svn commit: r671135 - in /xerces/c/branches/xerces-2/src/xercesc: internal/ validators/common/ validators/schema/

Author: borisk
Date: Tue Jun 24 04:24:10 2008
New Revision: 671135

URL: http://svn.apache.org/viewvc?rev=671135&view=rev
Log:
Implement the revised interpretation of ##other in which unqualified names are not matched. Fixes XERCESC-1758 and XERCESC-1655.

Modified:
    xerces/c/branches/xerces-2/src/xercesc/internal/IGXMLScanner2.cpp
    xerces/c/branches/xerces-2/src/xercesc/internal/SGXMLScanner.cpp
    xerces/c/branches/xerces-2/src/xercesc/validators/common/DFAContentModel.cpp
    xerces/c/branches/xerces-2/src/xercesc/validators/common/MixedContentModel.cpp
    xerces/c/branches/xerces-2/src/xercesc/validators/schema/SchemaValidator.cpp
    xerces/c/branches/xerces-2/src/xercesc/validators/schema/SubstitutionGroupComparator.cpp
    xerces/c/branches/xerces-2/src/xercesc/validators/schema/XercesElementWildcard.cpp

Modified: xerces/c/branches/xerces-2/src/xercesc/internal/IGXMLScanner2.cpp
URL: http://svn.apache.org/viewvc/xerces/c/branches/xerces-2/src/xercesc/internal/IGXMLScanner2.cpp?rev=671135&r1=671134&r2=671135&view=diff
==============================================================================
--- xerces/c/branches/xerces-2/src/xercesc/internal/IGXMLScanner2.cpp (original)
+++ xerces/c/branches/xerces-2/src/xercesc/internal/IGXMLScanner2.cpp Tue Jun 24 04:24:10 2008
@@ -3245,7 +3245,7 @@
                 anyEncountered = true;
             }
             else if ((type & 0x0f) == ContentSpecNode::Any_Other) {
-                if (uri != elementURI) {
+                if (uri != elementURI && elementURI != fEmptyNamespaceId) {
                     anyEncountered = true;
                 }
             }

Modified: xerces/c/branches/xerces-2/src/xercesc/internal/SGXMLScanner.cpp
URL: http://svn.apache.org/viewvc/xerces/c/branches/xerces-2/src/xercesc/internal/SGXMLScanner.cpp?rev=671135&r1=671134&r2=671135&view=diff
==============================================================================
--- xerces/c/branches/xerces-2/src/xercesc/internal/SGXMLScanner.cpp (original)
+++ xerces/c/branches/xerces-2/src/xercesc/internal/SGXMLScanner.cpp Tue Jun 24 04:24:10 2008
@@ -4700,7 +4700,7 @@
                 anyEncountered = true;
             }
             else if ((type & 0x0f) == ContentSpecNode::Any_Other) {
-                if (uri != elementURI) {
+                if (uri != elementURI && elementURI != fEmptyNamespaceId) {
                     anyEncountered = true;
                 }
             }

Modified: xerces/c/branches/xerces-2/src/xercesc/validators/common/DFAContentModel.cpp
URL: http://svn.apache.org/viewvc/xerces/c/branches/xerces-2/src/xercesc/validators/common/DFAContentModel.cpp?rev=671135&r1=671134&r2=671135&view=diff
==============================================================================
--- xerces/c/branches/xerces-2/src/xercesc/validators/common/DFAContentModel.cpp (original)
+++ xerces/c/branches/xerces-2/src/xercesc/validators/common/DFAContentModel.cpp Tue Jun 24 04:24:10 2008
@@ -205,7 +205,10 @@
                 }
                 else if ((type & 0x0f) == ContentSpecNode::Any_Other)
                 {
-                    if (inElem->getURI() != curElem->getURI()) {
+                    // Here we assume that empty string has id 1.
+	    	    //
+                    unsigned int uriId = curElem->getURI();
+                    if (uriId != 1 && uriId != inElem->getURI()) {
                         nextState = fTransTable[curState][elemIndex];
                         if (nextState != XMLContentModel::gInvalidTrans)
                             break;
@@ -303,7 +306,10 @@
             }
             else if ((type & 0x0f) == ContentSpecNode::Any_Other)
             {
-                if (inElem->getURI() != curElem->getURI())
+                // Here we assume that empty string has id 1.
+		//
+                unsigned int uriId = curElem->getURI();
+                if (uriId != 1 && uriId != inElem->getURI())
                 {
                     nextState = fTransTable[curState][elemIndex];
                     if (nextState != XMLContentModel::gInvalidTrans)
@@ -1217,4 +1223,3 @@
 }
 
 XERCES_CPP_NAMESPACE_END
-

Modified: xerces/c/branches/xerces-2/src/xercesc/validators/common/MixedContentModel.cpp
URL: http://svn.apache.org/viewvc/xerces/c/branches/xerces-2/src/xercesc/validators/common/MixedContentModel.cpp?rev=671135&r1=671134&r2=671135&view=diff
==============================================================================
--- xerces/c/branches/xerces-2/src/xercesc/validators/common/MixedContentModel.cpp (original)
+++ xerces/c/branches/xerces-2/src/xercesc/validators/common/MixedContentModel.cpp Tue Jun 24 04:24:10 2008
@@ -178,8 +178,12 @@
                 if (inChild->getURI() != curChild->getURI())
                     return outIndex;
             }
-            else if (type == ContentSpecNode::Any_Other) {
-                if (inChild->getURI() == curChild->getURI())
+            else if (type == ContentSpecNode::Any_Other)
+            {
+                // Here we assume that empty string has id 1.
+		//
+                unsigned int uriId = curChild->getURI();
+                if (uriId == 1 || uriId == inChild->getURI())
                     return outIndex;
             }
 
@@ -225,8 +229,12 @@
                     if (inChild->getURI() == curChild->getURI())
                         break;
                 }
-                else if (type == ContentSpecNode::Any_Other) {
-                    if (inChild->getURI() != curChild->getURI())
+                else if (type == ContentSpecNode::Any_Other)
+                {
+                  // Here we assume that empty string has id 1.
+		  //
+                  unsigned int uriId = curChild->getURI();
+                  if (uriId != 1 && uriId != inChild->getURI())
                         break;
                 }
 
@@ -282,8 +290,12 @@
                 if (inChild->getURI() != curChild->getURI())
                     return outIndex;
             }
-            else if (type == ContentSpecNode::Any_Other) {
-                if (inChild->getURI() == curChild->getURI())
+            else if (type == ContentSpecNode::Any_Other)
+            {
+              // Here we assume that empty string has id 1.
+              //
+              unsigned int uriId = curChild->getURI();
+              if (uriId == 1 || uriId == inChild->getURI())
                     return outIndex;
             }
 
@@ -320,8 +332,12 @@
                     if (inChild->getURI() == curChild->getURI())
                         break;
                 }
-                else if (type == ContentSpecNode::Any_Other) {
-                    if (inChild->getURI() != curChild->getURI())
+                else if (type == ContentSpecNode::Any_Other)
+                {
+                  // Here we assume that empty string has id 1.
+                  //
+                  unsigned int uriId = curChild->getURI();
+                  if (uriId != 1 && uriId != inChild->getURI())
                         break;
                 }
 
@@ -388,4 +404,3 @@
 }
 
 XERCES_CPP_NAMESPACE_END
-

Modified: xerces/c/branches/xerces-2/src/xercesc/validators/schema/SchemaValidator.cpp
URL: http://svn.apache.org/viewvc/xerces/c/branches/xerces-2/src/xercesc/validators/schema/SchemaValidator.cpp?rev=671135&r1=671134&r2=671135&view=diff
==============================================================================
--- xerces/c/branches/xerces-2/src/xercesc/validators/schema/SchemaValidator.cpp (original)
+++ xerces/c/branches/xerces-2/src/xercesc/validators/schema/SchemaValidator.cpp Tue Jun 24 04:24:10 2008
@@ -1890,9 +1890,11 @@
     unsigned int baseURI = baseSpecNode->getElement()->getURI();
     unsigned int derivedURI = derivedSpecNode->getElement()->getURI();
 
+    // Below we assume that empty string has id 1.
+    //
     if (((derivedType & 0x0f) == ContentSpecNode::Any_Other) &&
         ((baseType & 0x0f) == ContentSpecNode::Any_Other) &&
-        baseURI == derivedURI) {
+        baseURI == derivedURI || baseURI == 1) {
         return true;
     }
 
@@ -1904,7 +1906,7 @@
         }
 
         if (((baseType & 0x0f) == ContentSpecNode::Any_Other) &&
-            baseURI != derivedURI) {
+            derivedURI == 1 || baseURI != derivedURI) {
             return true;
         }
     }

Modified: xerces/c/branches/xerces-2/src/xercesc/validators/schema/SubstitutionGroupComparator.cpp
URL: http://svn.apache.org/viewvc/xerces/c/branches/xerces-2/src/xercesc/validators/schema/SubstitutionGroupComparator.cpp?rev=671135&r1=671134&r2=671135&view=diff
==============================================================================
--- xerces/c/branches/xerces-2/src/xercesc/validators/schema/SubstitutionGroupComparator.cpp (original)
+++ xerces/c/branches/xerces-2/src/xercesc/validators/schema/SubstitutionGroupComparator.cpp Tue Jun 24 04:24:10 2008
@@ -215,8 +215,11 @@
     // whether the uri is allowed directly by the wildcard
     unsigned int uriId = element->getURI();
 
+    // Here we assume that empty string has id 1.
+    //
     if ((!wother && uriId == wuri) ||
         (wother &&
+         uriId != 1 &&
          uriId != wuri &&
          uriId != XMLContentModel::gEOCFakeId &&
          uriId != XMLContentModel::gEpsilonFakeId &&
@@ -244,8 +247,11 @@
     {
         unsigned int subUriId = subsElements->elementAt(i)->getElementName()->getURI();
 
+        // Here we assume that empty string has id 1.
+        //
         if ((!wother && subUriId == wuri) ||
             (wother &&
+             subUriId != 1 &&
              subUriId != wuri &&
              subUriId != XMLContentModel::gEOCFakeId &&
              subUriId != XMLContentModel::gEpsilonFakeId &&
@@ -263,4 +269,3 @@
 /**
   * End of file SubstitutionGroupComparator.cpp
   */
-

Modified: xerces/c/branches/xerces-2/src/xercesc/validators/schema/XercesElementWildcard.cpp
URL: http://svn.apache.org/viewvc/xerces/c/branches/xerces-2/src/xercesc/validators/schema/XercesElementWildcard.cpp?rev=671135&r1=671134&r2=671135&view=diff
==============================================================================
--- xerces/c/branches/xerces-2/src/xercesc/validators/schema/XercesElementWildcard.cpp (original)
+++ xerces/c/branches/xerces-2/src/xercesc/validators/schema/XercesElementWildcard.cpp Tue Jun 24 04:24:10 2008
@@ -93,22 +93,26 @@
         return true;
     }
     else if (((t1 & 0x0f) == ContentSpecNode::Any_NS) &&
-             ((t2 & 0x0f) == ContentSpecNode::Any_NS) &&
-             (w1 == w2)) {
+             ((t2 & 0x0f) == ContentSpecNode::Any_NS)) {
         // if both are "some_namespace" and equal, then intersects
-        return true;
+        return w1 == w2;
     }
     else if (((t1 & 0x0f) == ContentSpecNode::Any_Other) &&
              ((t2 & 0x0f) == ContentSpecNode::Any_Other)) {
-        // if both are "##other", and equal, then intersects
+        // if both are "##other", then intersects
         return true;
     }
-    else if (((((t1 & 0x0f) == ContentSpecNode::Any_NS) &&
-               ((t2 & 0x0f) == ContentSpecNode::Any_Other)) ||
-              (((t1 & 0x0f) == ContentSpecNode::Any_Other) &&
-               ((t2 & 0x0f) == ContentSpecNode::Any_NS))) &&
-             (w1 != w2)) {
-        return true;
+    // Below we assume that empty string has id 1.
+    //
+    else if (((t1 & 0x0f) == ContentSpecNode::Any_NS) &&
+             ((t2 & 0x0f) == ContentSpecNode::Any_Other))
+    {
+      return w1 != w2 && w1 != 1;
+    }
+    else if (((t1 & 0x0f) == ContentSpecNode::Any_Other) &&
+             ((t2 & 0x0f) == ContentSpecNode::Any_NS))
+    {
+      return w1 != w2 && w2 != 1;
     }
     return false;
 }



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