digester = DigesterFactory.newDigester(validation, namespaceAware, ruleSet);
}
public TaglibXml parse(TldResourcePath path) throws IOException, SAXException {
try (InputStream is = path.openStream()) {
XmlErrorHandler handler = new XmlErrorHandler();
digester.setErrorHandler(handler);
TaglibXml taglibXml = new TaglibXml();
digester.push(taglibXml);
InputSource source = new InputSource(path.toExternalForm());
source.setByteStream(is);
digester.parse(source);
if (!handler.getWarnings().isEmpty() || !handler.getErrors().isEmpty()) {
handler.logFindings(LOG, source.getSystemId());
if (!handler.getErrors().isEmpty()) {
// throw the first to indicate there was a error during processing
throw handler.getErrors().iterator().next();
}
}
return taglibXml;
} finally {
digester.reset();