Here you can find the source of createDocument(String pageID)
private static Document createDocument(String pageID) throws ParserConfigurationException
//package com.java2s; /****************************************************************************** * Copyright (c) 2000-2017 Ericsson Telecom AB * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html ******************************************************************************/ import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import org.w3c.dom.DOMImplementation; import org.w3c.dom.Document; public class Main { private static Document createDocument(String pageID) throws ParserConfigurationException { final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setNamespaceAware(true); DocumentBuilder builder = factory.newDocumentBuilder(); DOMImplementation implementation = builder.getDOMImplementation(); // Create an xml document return implementation.createDocument(null, pageID, null); }/*from w w w. j av a2 s .c o m*/ }