return parse(is, DefaultXMLValidate);
}
private XMLTree parse(InputSource is, boolean validate)
throws IOException, SAXParseException, SAXException {
Parser parser = (validate) ?
new ValidatingParser(true) : new Parser();
Resolver resolver = new Resolver();
XmlDocumentBuilder builder = new XmlDocumentBuilder();
// Server.xml is not validated and has no DTD ( and will change for a while)
// URL serverURL = this.getClass().getResource(
// Constants.DTD.Server.Resource);
URL webApplicationURL = this.getClass().getResource(
Constants.WEB_XML_Resource);
// resolver.registerCatalogEntry(Constants.DTD.Server.PublicId,
// serverURL.toString());
resolver.registerCatalogEntry(
Constants.WEB_XML_PublicId,
webApplicationURL.toString());
try {
// parser.setFastStandalone(true);
parser.setEntityResolver(resolver);
builder.setDisableNamespaces(true);
builder.setParser(parser);
parser.parse(is);
doc = builder.getDocument();
} catch (Exception e) {
String systemId = "";
int lineNumber = -1;