List of utility methods to do XML Document Parse
Document | parse(final DocumentBuilder documentBuilder, final File pomFile) parse try { return documentBuilder.parse(pomFile); } catch (final Exception e) { throw new IllegalStateException(e.getMessage(), e); |
Document | parse(String document) parse return parse(new ByteArrayInputStream(document.getBytes())); |
Document | parseDocument(byte[] bytes) parse Document DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance(); documentBuilderFactory.setNamespaceAware(true); DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder(); InputStream is = new ByteArrayInputStream(bytes); try { return documentBuilder.parse(is); } finally { is.close(); ... |
Document | parseDocument(File f) parse Document InputStream stream = new FileInputStream(f); Document doc = builder.parse(stream); stream.close(); return doc; |
Document | parseDocument(File file) Utility method for constructing a Document from an XML file. DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
return builder.parse(file);
|
Document | parseDocument(InputSource is) Parses the given InputSource into a Document . DocumentBuilder builder = newDocumentBuilder(); try { return builder.parse(is); } catch (IOException e) { throw new RuntimeException(e); } catch (SAXException e) { if (e instanceof SAXParseException) { throw (SAXParseException) e; ... |
Document | parseDocument(InputStream documentXml) Creates a new document object from the given input stream containing the document XML. return parseDocument(documentXml, true);
|
Document | parseDocument(InputStream in) parse Document try { return DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(in); } catch (Exception e) { throw new RuntimeException(e); |
Document | parseDocument(InputStream is) Parses the given input stream as XML and returns the corresponding DOM document. getImplementation(); DOMImplementationLS implLS = (DOMImplementationLS) impl; LSInput input = implLS.createLSInput(); input.setByteStream(is); LSParser builder = implLS.createLSParser(DOMImplementationLS.MODE_SYNCHRONOUS, null); DOMConfiguration config = builder.getDomConfig(); config.setParameter("comments", false); config.setParameter("element-content-whitespace", false); ... |
Document | parseDocument(InputStream is) parse Document DocumentBuilder builder = getBuilder(); try { return builder.parse(is); } finally { releaseBuilder(builder); |