List of utility methods to do XML Document from Stream
Document | getXML(InputStream stream) get XML DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); try { return docFactory.newDocumentBuilder().parse(stream); } catch (ParserConfigurationException e) { e.printStackTrace(); } catch (UnknownHostException e) { e.printStackTrace(); return null; |
Document | getXML(InputStream stream) Reads XML from a stream DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); try { return docFactory.newDocumentBuilder().parse(stream); } catch (ParserConfigurationException ignored) { System.out.println("getXML parser error v001"); } catch (UnknownHostException e) { System.out.println("getXML UnknowHost error v002"); return null; |
Document | load(InputStream data) load try { return DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(data); } catch (ParserConfigurationException e) { throw new RuntimeException(e.getMessage(), e); |
Document | load(InputStream inputStream) load return getDocumentBuilder().parse(inputStream);
|
Document | load(InputStream stream) load DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
return builder.parse(stream);
|
Document | loadDocument(InputStream documentInputStream) Loads a DOM document from the given input stream. try { DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance(); documentBuilderFactory.setNamespaceAware(true); return documentBuilderFactory.newDocumentBuilder().parse(documentInputStream); } catch (ParserConfigurationException e) { throw new RuntimeException(e); |
Document | loadDocument(InputStream documentInputStream) load Document DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
documentBuilderFactory.setNamespaceAware(true);
DocumentBuilder documentBuilder;
documentBuilder = documentBuilderFactory.newDocumentBuilder();
return documentBuilder.parse(documentInputStream);
|
Document | loadDocument(InputStream in) Method should be invoked only from unit tests BufferedReader reader = new BufferedReader(new InputStreamReader(in)); StringBuffer sbuf = new StringBuffer(); try { String line = null; while ((line = reader.readLine()) != null) { sbuf.append(line); sbuf.append(System.getProperty("line.separator")); } finally { reader.close(); return loadDocument(sbuf.toString()); |
Document | loadDocument(InputStream is) XML DOM helper. DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
Document doc = builder.parse(is);
return doc;
|
Document | loadDocument(InputStream is) load Document return getDefaultFactory().newDocumentBuilder().parse(is);
|