question: 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 ; }
target:  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