private Element parse(InputSource source) {
try {
DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance();
builderFactory.setNamespaceAware(true);
builderFactory.setValidating(false);
DocumentBuilder builder = builderFactory.newDocumentBuilder();
builder.setErrorHandler(new ErrorHandler() {
public void error(SAXParseException e)
throws SAXParseException {
throw e;
}
public void fatalError(SAXParseException e)
throws SAXParseException {
throw e;
}
public void warning(SAXParseException err)
throws SAXParseException {
// do nothing
}
});
// builder.setEntityResolver(new NullEntityResolver());
return builder.parse(source).getDocumentElement();
} catch (ParserConfigurationException e) {
throw new ToolException("parsing.parserConfigException", e);
} catch (FactoryConfigurationError e) {
throw new ToolException("parsing.factoryConfigException", e);
} catch (SAXException e) {