You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by am...@apache.org on 2007/02/07 11:16:08 UTC

svn commit: r504486 - /xerces/c/branches/xerces-2.7/src/xercesc/validators/schema/identity/ValueStore.cpp

Author: amassari
Date: Wed Feb  7 02:16:08 2007
New Revision: 504486

URL: http://svn.apache.org/viewvc?view=rev&rev=504486
Log:
Even if the XSTS suite thinks differently, the XMLSchema 1.1 clarifies that two values derived from the same value space should be treated as equals; so find out the common ancestor and use it to perform the comparison

Modified:
    xerces/c/branches/xerces-2.7/src/xercesc/validators/schema/identity/ValueStore.cpp

Modified: xerces/c/branches/xerces-2.7/src/xercesc/validators/schema/identity/ValueStore.cpp
URL: http://svn.apache.org/viewvc/xerces/c/branches/xerces-2.7/src/xercesc/validators/schema/identity/ValueStore.cpp?view=diff&rev=504486&r1=504485&r2=504486
==============================================================================
--- xerces/c/branches/xerces-2.7/src/xercesc/validators/schema/identity/ValueStore.cpp (original)
+++ xerces/c/branches/xerces-2.7/src/xercesc/validators/schema/identity/ValueStore.cpp Wed Feb  7 02:16:08 2007
@@ -224,25 +224,15 @@
         return false;
     }
 
-    // are the validators equal?
-    // As always we are obliged to compare by reference...
-    if (dv1 == dv2) {
-        return ((dv1->compare(val1, val2, fMemoryManager)) == 0);
-    }
-
-    // see if this.fValidator is derived from value.fValidator:
-    DatatypeValidator* tempVal = dv1;
-    for(; tempVal != NULL && tempVal != dv2; tempVal = tempVal->getBaseValidator()) ;
-
-    if (tempVal) { // was derived!
-        return ((dv2->compare(val1, val2, fMemoryManager)) == 0);
-    }
-
-    // see if value.fValidator is derived from this.fValidator:
-    for(tempVal = dv2; tempVal != NULL && tempVal != dv1; tempVal = tempVal->getBaseValidator()) ;
-
-    if(tempVal) { // was derived!
-        return ((dv1->compare(val1, val2, fMemoryManager)) == 0);
+    // find the common ancestor, if there is one
+    DatatypeValidator* tempVal1 = dv1;
+    while(tempVal1)
+    {
+        DatatypeValidator* tempVal2 = dv2;
+        for(; tempVal2 != NULL && tempVal2 != tempVal1; tempVal2 = tempVal2->getBaseValidator()) ;
+        if (tempVal2) 
+            return ((tempVal2->compare(val1, val2, fMemoryManager)) == 0);
+        tempVal1=tempVal1->getBaseValidator();
     }
 
     // if we're here it means the types weren't related. They are different:
@@ -251,7 +241,7 @@
 
 
 // ---------------------------------------------------------------------------
-//  ValueStore: Docuement handling methods
+//  ValueStore: Document handling methods
 // ---------------------------------------------------------------------------
 void ValueStore::endDcocumentFragment(ValueStoreCache* const valueStoreCache) {
 



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