Java tutorial
//package com.java2s; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import org.w3c.dom.Document; import org.w3c.dom.Element; public class Main { public static Document blankDocument(String paramString) throws Exception { DocumentBuilderFactory localDocumentBuilderFactory = DocumentBuilderFactory.newInstance(); localDocumentBuilderFactory.setIgnoringComments(false); localDocumentBuilderFactory.setIgnoringElementContentWhitespace(false); localDocumentBuilderFactory.setValidating(false); localDocumentBuilderFactory.setCoalescing(false); DocumentBuilder localDocumentBuilder = localDocumentBuilderFactory.newDocumentBuilder(); Document localDocument = localDocumentBuilder.newDocument(); Element localElement = localDocument.createElement(paramString); localDocument.appendChild(localElement); return localDocument; } }