Here you can find the source of addElement(Document doc, Element parent, String nodeName)
public static Element addElement(Document doc, Element parent, String nodeName)
//package com.java2s; //License from project: Apache License import org.w3c.dom.Document; import org.w3c.dom.Element; public class Main { public static Element addElement(Document doc, Element parent, String nodeName) { Element el = null;//from w w w .ja v a2 s.c o m if (doc != null) el = doc.createElement(nodeName); if (parent != null) parent.appendChild(el); return el; } }