*
* @return false
* If this complex type needs to be rejected.
*/
protected boolean checkIfExtensionSafe(XSComplexType baseType, XSComplexType thisType) {
XSComplexType lastType = getLastRestrictedType(baseType);
if (lastType == null) {
return true; // no restriction in derivation chain
}
NameClass anc = NameClass.NULL;
// build name class for attributes in new complex type
Iterator itr = thisType.iterateDeclaredAttributeUses();
while (itr.hasNext()) {
anc = new ChoiceNameClass(anc, getNameClass(((XSAttributeUse) itr.next()).getDecl()));
}
// TODO: attribute wildcard
NameClass enc = getNameClass(thisType.getExplicitContent());
// check against every base type ... except the root anyType
while (lastType != lastType.getBaseType()) {
if (checkCollision(anc, enc, lastType)) {
return false;
}
if (lastType.getBaseType().isSimpleType()) // if the base type is a simple type, there won't be
// any further name collision.
{
return true;
}
lastType = lastType.getBaseType().asComplexType();
}
return true; // OK
}