public Document parse(File file) throws SAXException, IOException {
try {
OMDOMFactory factory = new OMDOMFactory();
XMLStreamReader reader = XMLInputFactory.newInstance()
.createXMLStreamReader(new FileInputStream(file));
StAXOMBuilder builder = new StAXOMBuilder(factory, reader);
return (DocumentImpl) builder.getDocument();
} catch (XMLStreamException e) {
throw new SAXException(e);
}
}