public static XMLInputSource resolveDocument(XSDDescription desc,Hashtable locationPairs,XMLEntityResolver entityResolver) throws IOException {
  String loc=null;
  if (desc.getContextType() == XSDDescription.CONTEXT_IMPORT || desc.fromInstance()) {
    String namespace=desc.getTargetNamespace();
    String ns=namespace == null ? XMLSymbols.EMPTY_STRING : namespace;
    LocationArray tempLA=(LocationArray)locationPairs.get(ns);
    if (tempLA != null)     loc=tempLA.getFirstLocation();
  }
  if (loc == null) {
    String[] hints=desc.getLocationHints();
    if (hints != null && hints.length > 0)     loc=hints[0];
  }
  String expandedLoc=XMLEntityManager.expandSystemId(loc,desc.getBaseSystemId(),false);
  desc.setLiteralSystemId(loc);
  desc.setExpandedSystemId(expandedLoc);
  return entityResolver.resolveEntity(desc);
}

public static XMLInputSource resolveDocument ( XSDDescription desc , Hashtable locationPairs , XMLEntityResolver entityResolver ) throws IOException { String loc = null ; if ( desc . getContextType ( ) == XSDDescription . CONTEXT_IMPORT || desc . fromInstance ( ) ) { String namespace = desc . getTargetNamespace ( ) ; String ns = namespace == null ? XMLSymbols . EMPTY_STRING : namespace ; LocationArray tempLA = ( LocationArray ) locationPairs . get ( ns ) ; if ( tempLA != null ) loc = tempLA . getFirstLocation ( ) ; } if ( loc == null ) { String [ ] hints = desc . getLocationHints ( ) ; if ( hints != null && hints . length > 0 ) loc = hints [ 0 ] ; } String expandedLoc = XMLEntityManager . expandSystemId ( loc , desc . getBaseSystemId ( ) , false ) ; desc . setLiteralSystemId ( loc ) ; desc . setExpandedSystemId ( expandedLoc ) ; return entityResolver . resolveEntity ( desc ) ; }
this method tries to resolve location of the given schema . the loader stores the namespace / location pairs in a hashtable ( use " " as the namespace of absent namespace ) . when resolving an entity , loader first tries to find in the hashtable whether there is a value for that namespace , if so , pass that location value to the user - defined entity resolver .
