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

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