Here you can find the source of newDocument()
Parameter | Description |
---|---|
ParserConfigurationException | an exception |
public static Document newDocument() throws ParserConfigurationException
//package com.java2s; /* Please see the license information at the end of this file. */ import javax.xml.parsers.*; import org.w3c.dom.*; public class Main { /** Creates a new empty DOM document. *//from w ww . ja v a 2s .c o m * @return New empty DOM document. * * @throws ParserConfigurationException */ public static Document newDocument() throws ParserConfigurationException { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = factory.newDocumentBuilder(); return builder.newDocument(); } }