Java tutorial
import org.w3c.dom.Document; import org.w3c.dom.Element; public class Utils { /** * Add a new element to the given parent * @param parent the parent Element * @param name the child name * @return new Element */ public static Element createElement(Element parent, String name) { Document document; Element element; document = parent.getOwnerDocument(); element = document.createElement(name); parent.appendChild(element); return element; } }