Here you can find the source of createDocument(String docElt)
Parameter | Description |
---|---|
docElt | name of the document element |
public static Document createDocument(String docElt)
//package com.java2s; import org.w3c.dom.DOMImplementation; import org.w3c.dom.Document; import org.w3c.dom.bootstrap.DOMImplementationRegistry; public class Main { private static DOMImplementation impl; private static DOMImplementationRegistry registry; /**/*from w w w. ja v a 2 s . c om*/ * Creates a new DOM document. * * @param docElt * name of the document element * @return a new DOM document if something goes wrong */ public static Document createDocument(String docElt) { getImplementation(); return impl.createDocument("", docElt, null); } public static Document createDocument(String namespaceURI, String docElt) { getImplementation(); return impl.createDocument(namespaceURI, docElt, null); } /** * Creates a new instance of the DOM registry and get an implementation of * DOM 3 with Load Save objects. * */ private static void getImplementation() { if (registry == null) { try { registry = DOMImplementationRegistry.newInstance(); } catch (ClassCastException | ClassNotFoundException | InstantiationException | IllegalAccessException e) { e.printStackTrace(); } } if (impl == null) { impl = registry.getDOMImplementation("Core 3.0 XML 3.0 LS"); } } }