SAXDocumentFactory sdf;
if (doc != null) {
sdf = new SAXDocumentFactory(doc.getImplementation(),
XMLResourceDescriptor.getXMLParserClassName());
} else {
sdf = new SAXDocumentFactory(new GenericDOMImplementation(),
XMLResourceDescriptor.getXMLParserClassName());
}
return DOMUtilities.parseXML(text, doc, uri, null, null, sdf);
}