Java examples for XML:DOM Document
get XML Document from DocumentBuilder
//package com.java2s; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import org.w3c.dom.Document; public class Main { private static Document document; public static Document getDocument() throws ParserConfigurationException { if (document == null) { DocumentBuilderFactory docFactory = DocumentBuilderFactory .newInstance();//from w w w .ja v a 2 s .c o m DocumentBuilder docBuilder = docFactory.newDocumentBuilder(); document = docBuilder.newDocument(); } return document; } }