Java XML Document Create createEmptyDocument()

Here you can find the source of createEmptyDocument()

Description

Create empty document

License

Open Source License

Exception

Parameter Description
ParserConfigurationException an exception

Declaration

public static Document createEmptyDocument() throws ParserConfigurationException 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import org.w3c.dom.Document;

import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;

public class Main {
    /**/* w  w  w .j a va  2 s. c o m*/
     * Create empty document
     *
     * @return
     * @throws ParserConfigurationException
     */
    public static Document createEmptyDocument() throws ParserConfigurationException {
        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
        DocumentBuilder builder = dbf.newDocumentBuilder();
        return builder.newDocument();
    }
}

Related

  1. createDocumentFromXmlFragment(final InputStream inputStreamXmlFragment, final URL urlSchema)
  2. createDocumentFromXmlString(String xmlStr)
  3. createEmptyDocument()
  4. createEmptyDocument()
  5. createEmptyDocument()
  6. createEmptyDocument(final DocumentBuilder builder)
  7. createEmptyElement(Document doc, QName qname)
  8. createNewDocument()
  9. createNewDocument(DocumentBuilder docBuilder)