Java tutorial
//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 DocumentBuilderFactory s_documentBuilderFactory; public static Document createDocument() throws ParserConfigurationException { DocumentBuilder documentBuilder = s_documentBuilderFactory.newDocumentBuilder(); Document document = documentBuilder.newDocument(); return document; } }