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 { public static Document creatXMLFile() throws ParserConfigurationException { Document doc = null; // Create instance of DocumentBuilderFactory final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); // Get the DocumentBuilder final DocumentBuilder parser = factory.newDocumentBuilder(); // Create blank DOM Document doc = parser.newDocument(); return doc; } }