List of utility methods to do XML Document Create
Document | newDocument() new Document ensureFactory(); try { DocumentBuilder builder = mFactory.newDocumentBuilder(); return builder.newDocument(); } catch (ParserConfigurationException e) { return null; |
Document | newDocument() new Document return cDocumentBuilderFactory.newDocumentBuilder().newDocument();
|
Document | newDocument() Construct a new empty document. try { return newBuilder().newDocument(); } catch (ParserConfigurationException e) { throw new RuntimeException("Cannot create new document", e); |
Document | newDocument(boolean isNamespaceAware, boolean isValidating) __UNDOCUMENTED__ DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory = DocumentBuilderFactory.newInstance(); factory.setNamespaceAware(isNamespaceAware); factory.setValidating(isValidating); try { DocumentBuilder builder = factory.newDocumentBuilder(); return builder.newDocument(); } catch (ParserConfigurationException pce) { ... |
Document | newDocument(File file) new Document try { return DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(file); } catch (Exception e) { throw new IllegalStateException("Error parsing project set file: ".concat(file.getAbsolutePath()), e); |
Document | newDocument(String namespaceURI, String qualifiedName) Create a new, empty Document with the specified root element. try { return DOMImplementationRegistry.newInstance().getDOMImplementation("XML 3.0") .createDocument(namespaceURI, qualifiedName, null); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException exception) { throw new IllegalStateException("DOM Implementation can not be created", exception); |
Document | newDocument(String rootName) new Document DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
Document doc = builder.newDocument();
doc.appendChild(doc.createElement(rootName));
return (doc);
|
Document | newXmlDocument() Factory method to create a new XML document object. DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setNamespaceAware(true);
DocumentBuilder builder = dbf.newDocumentBuilder();
Document xmlDocument = builder.newDocument();
return xmlDocument;
|
Document | newXmlDocument() new Xml Document try { DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder = docFactory.newDocumentBuilder(); return docBuilder.newDocument(); } catch (ParserConfigurationException ex) { System.err.println("Error: Canot create new XML document"); System.err.println("Cause: " + ex.getMessage()); System.exit(1); ... |
Document | newXMLDocument() new XML Document try { return newDocumentBuilder().newDocument(); } catch (ParserConfigurationException e) { throw new RuntimeException(e.getMessage()); |