Here you can find the source of getNewDocument()
public static Document getNewDocument() throws ParserConfigurationException
//package com.java2s; //License from project: Apache License import org.w3c.dom.Document; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; public class Main { public static Document getNewDocument() throws ParserConfigurationException { return getNewDocument(false); }//from w w w. j a va 2 s . c o m public static Document getNewDocument(Boolean nameSpaceAwareness) throws ParserConfigurationException { DocumentBuilder builder = getDocumentBuilder(false); return builder.newDocument(); } private static DocumentBuilder getDocumentBuilder(boolean NamespaceAwareness) throws ParserConfigurationException { DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance(); domFactory.setNamespaceAware(NamespaceAwareness); //domFactory.setValidating(true); //domFactory.setIgnoringElementContentWhitespace( true ); domFactory.setAttribute("http://apache.org/xml/features/dom/include-ignorable-whitespace", Boolean.FALSE); return domFactory.newDocumentBuilder(); } }