// use the given domDocumentClass (if not null)
if (domDocumentClass != null) {
try {
result = (org.w3c.dom.Document) domDocumentClass.newInstance();
} catch (Exception e) {
throw new DocumentException(
"Could not instantiate an instance "
+ "of DOM Document with class: "
+ domDocumentClass.getName(), e);
}
} else {
// lets try JAXP first before using the hardcoded default parsers
result = createDomDocumentViaJAXP();
if (result == null) {
Class theClass = getDomDocumentClass();
try {
result = (org.w3c.dom.Document) theClass.newInstance();
} catch (Exception e) {
throw new DocumentException("Could not instantiate an "
+ "instance of DOM Document " + "with class: "
+ theClass.getName(), e);
}
}
}