Here you can find the source of createEmptyDocument()
public static Document createEmptyDocument()
//package com.java2s; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import org.w3c.dom.Document; public class Main { public static Document createEmptyDocument() { final DocumentBuilderFactory factory = DocumentBuilderFactory .newInstance();/*from www . j a v a2s. c o m*/ try { return factory.newDocumentBuilder().newDocument(); } catch (ParserConfigurationException e) { throw new RuntimeException("Should not reach this point"); } } }