Here you can find the source of newDocument()
Parameter | Description |
---|---|
ParserConfigurationException | an exception |
FactoryConfigurationError | an exception |
public static Document newDocument() throws ParserConfigurationException, FactoryConfigurationError
//package com.java2s; //License from project: LGPL import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.FactoryConfigurationError; import javax.xml.parsers.ParserConfigurationException; import org.w3c.dom.Document; public class Main { private static DocumentBuilder docBuilder; /**/*from w w w . j av a2 s . c o m*/ * returns a new Empty XMl Document * @return new Document * @throws ParserConfigurationException * @throws FactoryConfigurationError */ public static Document newDocument() throws ParserConfigurationException, FactoryConfigurationError { if (docBuilder == null) { docBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); } return docBuilder.newDocument(); } }