Java examples for XML:DOM Document
init XML Document
//package com.java2s; import org.w3c.dom.Document; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; public class Main { private static Document document; private static Document init() { DocumentBuilderFactory factory = DocumentBuilderFactory .newInstance();/* ww w.j a va2 s . c o m*/ DocumentBuilder builder = null; try { builder = factory.newDocumentBuilder(); } catch (ParserConfigurationException e) { e.printStackTrace(); } return builder.newDocument(); } public static Document newInstance() { document = init(); return document; } }