try {
if(url.endsWith(".xsd")){
final InputStream is = new URL(url).openStream();
final XMLInputSource xis = new XMLInputSource(null, url, url, is, null);
final Grammar schema = parser.preparseGrammar(TYPE_XSD, xis);
is.close();
allGrammars.add(schema);
} else {
throw new XPathException(this, "Only XMLSchemas can be preparsed.");
}
} catch(final IOException ex) {
LOG.debug(ex);
throw new XPathException(this, ex);
} catch(final Exception ex) {
LOG.debug(ex);
throw new XPathException(this, ex);
}
}
LOG.debug("Successfully parsed "+allGrammars.size()+" grammars.");
// Send all XSD grammars to grammarpool
Grammar grammars[] = new Grammar[allGrammars.size()];
grammars = allGrammars.toArray(grammars);
grammarpool.cacheGrammars(TYPE_XSD, grammars);
// Construct result to end user
final ValueSequence result = new ValueSequence();