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 { /** * createXmlDocumnet creates a new Document object using the JAXP API. * @return Document a DOM style Document object. * @throws ParserConfigurationException */ public static Document createXmlDocument() throws ParserConfigurationException { DocumentBuilderFactory fact = DocumentBuilderFactory.newInstance(); DocumentBuilder db = fact.newDocumentBuilder(); Document doc = db.newDocument(); return (doc); } }