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 2009/08/21 12:36:58 UTC

svn commit: r806488 - /xerces/c/trunk/src/xercesc/validators/schema/SchemaValidator.cpp

Author: amassari
Date: Fri Aug 21 10:36:58 2009
New Revision: 806488

URL: http://svn.apache.org/viewvc?rev=806488&view=rev
Log:
When testing for simple type blocked substitutions, allow list and unions when base type is anySimpleType

Modified:
    xerces/c/trunk/src/xercesc/validators/schema/SchemaValidator.cpp

Modified: xerces/c/trunk/src/xercesc/validators/schema/SchemaValidator.cpp
URL: http://svn.apache.org/viewvc/xerces/c/trunk/src/xercesc/validators/schema/SchemaValidator.cpp?rev=806488&r1=806487&r2=806488&view=diff
==============================================================================
--- xerces/c/trunk/src/xercesc/validators/schema/SchemaValidator.cpp (original)
+++ xerces/c/trunk/src/xercesc/validators/schema/SchemaValidator.cpp Fri Aug 21 10:36:58 2009
@@ -15,6 +15,10 @@
  * limitations under the License.
  */
 
+/*
+ * $Id$
+ */
+
 // ---------------------------------------------------------------------------
 //  Includes
 // ---------------------------------------------------------------------------
@@ -683,15 +687,23 @@
                             }
                             else if(fCurrentDatatypeValidator != xsiTypeDV)
                             {
-                                // the type is derived from ancestor
-                                if ((((SchemaElementDecl*)elemDef)->getBlockSet() & SchemaSymbols::XSD_RESTRICTION) != 0) {
-                                    emitError(XMLValid::ElemNoSubforBlock, elemDef->getFullName());
-                                    fErrorOccurred = true;
+                                DatatypeValidator::ValidatorType derivedType=xsiTypeDV->getType();
+                                if((derivedType == DatatypeValidator::List || derivedType == DatatypeValidator::Union) && fCurrentDatatypeValidator==0)
+                                {
+                                    // the substitution is always allowed if the type is list or union and the base type was xs:anySimpleType
                                 }
-                                if (elemDef->hasAttDefs()) {
-                                    // if we have an attribute but xsi:type's type is simple, we have a problem...
-                                    emitError(XMLValid::NonDerivedXsiType, fXsiType->getRawName(), elemDef->getFullName());
-                                    fErrorOccurred = true;
+                                else
+                                {
+                                    // the type is derived from ancestor
+                                    if ((((SchemaElementDecl*)elemDef)->getBlockSet() & SchemaSymbols::XSD_RESTRICTION) != 0) {
+                                        emitError(XMLValid::ElemNoSubforBlock, elemDef->getFullName());
+                                        fErrorOccurred = true;
+                                    }
+                                    if (elemDef->hasAttDefs()) {
+                                        // if we have an attribute but xsi:type's type is simple, we have a problem...
+                                        emitError(XMLValid::NonDerivedXsiType, fXsiType->getRawName(), elemDef->getFullName());
+                                        fErrorOccurred = true;
+                                    }
                                 }
                             }
 



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