List of usage examples for org.jdom2.input StAXStreamBuilder build
public Document build(XMLStreamReader reader) throws JDOMException
From source file:org.kdp.word.utils.JDOMUtils.java
License:Apache License
public static Document parse(JDOMFactory factory, File inputfile) { try {//from ww w. j ava2 s . c om XMLInputFactory inputFactory = XMLInputFactory.newInstance(); XMLStreamReader reader = inputFactory.createXMLStreamReader(new FileInputStream(inputfile)); StAXStreamBuilder staxBuilder = new StAXStreamBuilder(); staxBuilder.setFactory(factory); return staxBuilder.build(reader); } catch (FileNotFoundException | XMLStreamException | JDOMException ex) { throw new IllegalStateException("Cannot parse XML: " + inputfile, ex); } }