OMDOMFactory factory = new OMDOMFactory();
// Not really sure whether this will work :-?
XMLStreamReader reader = StAXUtils
.createXMLStreamReader(inputSource.getCharacterStream());
StAXOMBuilder builder = new StAXOMBuilder(factory, reader);
DocumentImpl doc = (DocumentImpl) builder.getDocument();
((ElementImpl) doc.getDocumentElement()).build();
return (DocumentImpl) builder.getDocument();
} catch (XMLStreamException e) {
throw new SAXException(e);
}
}