Java tutorial
//package com.java2s; import org.w3c.dom.Document; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; public class Main { /** * Creates an empty XML Document. * @return A empty XML document * @throws ParserConfigurationException If creation fails because of parser configuratino. */ public static Document newDocument() throws ParserConfigurationException { return DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument(); } }