{
if (locs == null || locs.size() == 0)
throw new IllegalArgumentException("Illegal schema location map");
JBossXSErrorHandler xserr = new JBossXSErrorHandler();
JBossWSEntityResolver resolver = new JBossWSEntityResolver();
JBossXSEntityResolver xsresolve = new JBossXSEntityResolver(resolver, locs);
XMLSchemaLoader loader = (XMLSchemaLoader)schemautils.getXSLoader(xserr, xsresolve);
int index = 0;
SchemaGrammar[] gs = new SchemaGrammar[locs.size()];
Iterator<String> it = locs.keySet().iterator();
while (it.hasNext())
{
InputStream in = null;
try
{
String nsURI = it.next();
URL orgURL = locs.get(nsURI);
URL resURL = resolveNamespaceURI(resolver, nsURI);
URL url = resURL != null ? resURL : orgURL;
log.debug("Load schema: " + nsURI + "=" + url);
XMLInputSource inputSource = new XMLInputSource(null, url.toExternalForm(), null);
InputSource tmpSrc = resolver.resolveEntity(null, url.toExternalForm());
in = tmpSrc.getByteStream() != null ? tmpSrc.getByteStream() : new ResourceURL(url).openStream();
inputSource.setByteStream(in);
SchemaGrammar grammar = (SchemaGrammar)loader.loadGrammar(inputSource);
if (grammar == null)