public InputSource loadSource(String href, String context, XSLTC xsltc) {
try {
Source source = null;
if (_uriResolver != null) {
source = _uriResolver.resolve(href, context);
}
if (source == null && _catalogFiles != null &&
_xmlFeatures.getFeature(JdkXmlFeatures.XmlFeature.USE_CATALOG)) {
if (_catalogUriResolver == null) {
_catalogUriResolver = CatalogManager.catalogResolver(_catalogFeatures);
}
source = _catalogUriResolver.resolve(href, context);
}
if (source != null) {
return Util.getInputSource(xsltc, source);
}
}
catch (TransformerException e) {
// should catch it when the resolver explicitly throws the exception
final ErrorMsg msg = new ErrorMsg(ErrorMsg.INVALID_URI_ERR, href + "
" + e.getMessage(), this);
xsltc.getParser().reportError(Constants.FATAL, msg);
}
catch (CatalogException e) {
final ErrorMsg msg = new ErrorMsg(ErrorMsg.CATALOG_EXCEPTION, href + "
" + e.getMessage(), this);
xsltc.getParser().reportError(Constants.FATAL, msg);
}
return null;
}
|