Here you can find the source of createDocument(String namespaceURI, String qualifiedName)
Parameter | Description |
---|---|
namespaceURI | The document namespace, may be <code>""</code>. |
qualifiedName | The document element name |
public static Document createDocument(String namespaceURI, String qualifiedName)
//package com.java2s; import org.w3c.dom.DOMImplementation; import org.w3c.dom.Document; import org.w3c.dom.bootstrap.DOMImplementationRegistry; public class Main { /**/*from w w w . j av a2 s .c o m*/ * Creates a new document with the given namespace and document element. * * @param namespaceURI * The document namespace, may be <code>""</code>. * @param qualifiedName * The document element name * @return the created document */ public static Document createDocument(String namespaceURI, String qualifiedName) { DOMImplementation impl = getDOMImplementation(); return impl.createDocument(namespaceURI, qualifiedName, null); } /** * Returns a DOM implementation that has the following features: * <ul> * <li>Core 3.0</li> * <li>XML 3.0</li> * <li>LS</li> * </ul> * * @return A {@link DOMImplementation} object that can be cast to * {@link DOMImplementationLS}. */ public static DOMImplementation getDOMImplementation() { try { DOMImplementationRegistry registry = DOMImplementationRegistry.newInstance(); return registry.getDOMImplementation("Core 3.0 XML 3.0 LS"); } catch (Exception e) { throw new RuntimeException(e); } } }