List of utility methods to do XML Document from File
Document | loadXmlFromFile(String xmlFileName) Loads an xml file on disk into a document DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); docFactory.setNamespaceAware(true); try { return docFactory.newDocumentBuilder().parse(new File(xmlFileName)); } catch (ParserConfigurationException e) { throw new RuntimeException("Error setting up UI xml page model parser -- " + e.getMessage()); } catch (SAXException e) { throw new RuntimeException( ... |
Document | read(InputStream input) read DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); try { DocumentBuilder db = dbf.newDocumentBuilder(); return db.parse(input); } catch (Exception e) { throw new RuntimeException(e.getMessage(), e); |
Node | read(InputStream xml) read DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
return builder.parse(xml).getDocumentElement();
|
org.w3c.dom.Document | read(java.io.File file) read try { return read(new java.io.FileInputStream(file)); } catch (java.io.IOException ioe) { throw new RuntimeException(file.toString(), ioe); |
Document | read(String file) read local file DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = factory.newDocumentBuilder(); Document dom = builder.parse(new File(file)); return dom; |
Document | read(String filename) read DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setValidating(false); DocumentBuilder builder = null; Document document = null; try { builder = factory.newDocumentBuilder(); builder.setEntityResolver(new EntityResolver() { public InputSource resolveEntity(String publicId, String systemId) ... |
Document | readDocument(String fileName) Reads document from file DocumentBuilder docBuilder; Document result = null; DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance(); docBuilderFactory.setIgnoringElementContentWhitespace(true); try { docBuilder = docBuilderFactory.newDocumentBuilder(); } catch (ParserConfigurationException e) { throw new Error(e); ... |
Document | readDocumentXML(File file) Reads in an XML document from a local file. DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); InputStream in = new BufferedInputStream(new FileInputStream(file)); return builder.parse(in); |
Document | readXML(File file) read XML return getXML(new FileInputStream(file)); |
Document | readXML(File file) read XML DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
documentBuilderFactory.setNamespaceAware(true);
DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
return documentBuilder.parse(file);
|