// 1 If B and D are not the same type definition, then the {derivation method} of D must not be in the subset.
if ((derived.fDerivedBy & block) != 0)
return false;
// 2 One of the following must be true:
XSTypeDefinition directBase = derived.fBaseType;
// 2.2 B must be D's {base type definition}.
if (directBase == base)
return true;
// 2.3 All of the following must be true:
// 2.3.1 D's {base type definition} must not be the ur-type definition.
if (directBase == SchemaGrammar.fAnyType ||
directBase == SchemaGrammar.fAnySimpleType) {
return false;
}
// 2.3.2 The appropriate case among the following must be true:
// 2.3.2.1 If D's {base type definition} is complex, then it must be validly derived from B given the subset as defined by this constraint.
if (directBase.getTypeCategory() == XSTypeDefinition.COMPLEX_TYPE)
return checkComplexDerivation((XSComplexTypeDecl)directBase, base, block);
// 2.3.2.2 If D's {base type definition} is simple, then it must be validly derived from B given the subset as defined in Type Derivation OK (Simple) (3.14.6).
if (directBase.getTypeCategory() == XSTypeDefinition.SIMPLE_TYPE) {
// if base is complex type
if (base.getTypeCategory() == XSTypeDefinition.COMPLEX_TYPE) {
// if base is anyType, change base to anySimpleType,
// otherwise, not valid
if (base == SchemaGrammar.fAnyType)