Java tutorial
//package com.java2s; import org.w3c.dom.Document; import org.w3c.dom.Element; public class Main { /** * Creates the root tag node. * * @param baseDocument * the base document * @param rootTagName * the root tag name * @return the element */ public static Element createRootTagNode(Document baseDocument, String rootTagName) { Element newNode = baseDocument.createElement(rootTagName); baseDocument.appendChild(newNode); return newNode; } }