public DOMSource toDOMSourceFromSAX(SAXSource source) throws IOException, SAXException, ParserConfigurationException {
return new DOMSource(toDOMNodeFromSAX(source));
}
public Node toDOMNodeFromSAX(SAXSource source) throws ParserConfigurationException, IOException, SAXException {
SAX2DOM converter = new SAX2DOM(createDocument());
XMLReader xmlReader = source.getXMLReader();
if (xmlReader == null) {
xmlReader = createXMLReader();
}
xmlReader.setContentHandler(converter);
xmlReader.parse(source.getInputSource());
return converter.getDOM();
}