Java examples for XML:DOM Element Create
create Xml Element and add to parent element
//package com.java2s; import org.w3c.dom.Document; import org.w3c.dom.Element; public class Main { public static final Element createXmlElement(Document xml, Element parent, String name) { Element e = xml.createElement(name); try {//from ww w . jav a 2s .c om parent.appendChild(e); } catch (Exception ex) { System.out.println(ex.toString()); } return e; } }