Author: amassari
Date: Fri Aug 21 10:05:52 2009
New Revision: 806482

URL: http://svn.apache.org/viewvc?rev=806482&view=rev
Log:
When testing for blocked substitutions, check the entire inheritance chain

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=806482&r1=806481&r2=806482&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:05:52 2009
@@ -630,14 +630,21 @@
                                     fErrorOccurred = true;
                                 }
                                 else if(elemTypeInfo != typeInfo) {
-                                    int derivationMethod = 
typeInfo->getDerivedBy();
-                                    if 
((((SchemaElementDecl*)elemDef)->getBlockSet() & derivationMethod) != 0) {
-                                        emitError(XMLValid::ElemNoSubforBlock, 
elemDef->getFullName());
-                                        fErrorOccurred = true;
-                                    }
-                                    if ((tempType->getBlockSet() & 
derivationMethod) != 0) {
-                                        emitError(XMLValid::TypeNoSubforBlock, 
tempType->getTypeName());
-                                        fErrorOccurred = true;
+                                    // perform the check on the entire 
inheritance chain
+                                    ComplexTypeInfo* tempType = typeInfo;
+                                    while (tempType) {
+                                        if (tempType == elemTypeInfo)
+                                            break;
+                                        int derivationMethod = 
tempType->getDerivedBy();
+                                        if 
((((SchemaElementDecl*)elemDef)->getBlockSet() & derivationMethod) != 0) {
+                                            
emitError(XMLValid::ElemNoSubforBlock, elemDef->getFullName());
+                                            fErrorOccurred = true;
+                                        }
+                                        if ((elemTypeInfo->getBlockSet() & 
derivationMethod) != 0) {
+                                            
emitError(XMLValid::TypeNoSubforBlock, elemTypeInfo->getTypeName());
+                                            fErrorOccurred = true;
+                                        }
+                                        tempType = 
tempType->getBaseComplexTypeInfo();
                                     }
                                 }
                             }



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to