if (logger.isDebugEnabled()) {
logger.debug("Creating dissectable document for: " + path);
}
DissectableContentHandler contentHandler
= new DissectableContentHandler();
contentHandler.initialise(builder);
XMLReader parser = getXMLReader();
parser.setContentHandler(contentHandler);
// Prevent the external DTD from being loaded.
parser.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd",
false);
parser.setProperty("http://xml.org/sax/properties/lexical-handler",
contentHandler);
parser.setProperty("http://xml.org/sax/properties/declaration-handler",
contentHandler);
parser.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd",
false);
URL input = baseClass.getResource(path);
if (input == null) {
throw new FileNotFoundException(path);
}
try {
parser.parse(input.toExternalForm());
/*} catch (SAXParseException spe) {
spe.printStackTrace();
throw spe;*/
} catch (SAXException se) {
se.printStackTrace();
Exception cause = se.getException();
if (cause != null) {
System.out.println("Root Cause");
cause.printStackTrace();
}
throw se;
}
TestDocumentDetails document
= contentHandler.getTestDocumentDetails();
return document;
}