private boolean isDerivedByAny(String ancestorNS,String ancestorName,int derivationMethod,XSTypeDefinition type){
  XSTypeDefinition oldType=null;
  boolean derivedFrom=false;
  while (type != null && type != oldType) {
    if ((ancestorName.equals(type.getName())) && ((ancestorNS == null && type.getNamespace() == null) || (ancestorNS != null && ancestorNS.equals(type.getNamespace())))) {
      derivedFrom=true;
      break;
    }
    if (isDerivedByRestriction(ancestorNS,ancestorName,derivationMethod,type)) {
      return true;
    }
 else     if (!isDerivedByExtension(ancestorNS,ancestorName,derivationMethod,type)) {
      return true;
    }
    oldType=type;
    type=type.getBaseType();
  }
  return derivedFrom;
}

private boolean isDerivedByAny ( String ancestorNS , String ancestorName , int derivationMethod , XSTypeDefinition type ) { XSTypeDefinition oldType = null ; boolean derivedFrom = false ; while ( type != null && type != oldType ) { if ( ( ancestorName . equals ( type . getName ( ) ) ) && ( ( ancestorNS == null && type . getNamespace ( ) == null ) || ( ancestorNS != null && ancestorNS . equals ( type . getNamespace ( ) ) ) ) ) { derivedFrom = true ; break ; } if ( isDerivedByRestriction ( ancestorNS , ancestorName , derivationMethod , type ) ) { return true ; } else if ( ! isDerivedByExtension ( ancestorNS , ancestorName , derivationMethod , type ) ) { return true ; } oldType = type ; type = type . getBaseType ( ) ; } return derivedFrom ; }
checks if a type is derived from another by any combination of restriction , list ir union . see : http : / / www . w3 . org / tr / 2004 / rec - dom - level - 3 - core - 20040407 / core . html # typeinfo - isderivedfrom
