Here you can find the source of newXmlDocument()
public static final Document newXmlDocument() throws Exception
//package com.java2s; //License from project: Apache License import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import org.w3c.dom.Document; public class Main { /**/*from w w w. j a v a 2 s .co m*/ * Factory method to create a new XML document object. * @return */ public static final Document newXmlDocument() throws Exception { DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); dbf.setNamespaceAware(true); DocumentBuilder builder = dbf.newDocumentBuilder(); Document xmlDocument = builder.newDocument(); return xmlDocument; } }