Here you can find the source of addElement(Document doc, Node parent, String element)
public static Element addElement(Document doc, Node parent, String element)
//package com.java2s; import java.util.*; import org.w3c.dom.*; public class Main { public static Element addElement(Document doc, Node parent, String element) { return addElement(doc, parent, element, null); }/*from w w w . j ava2s. c o m*/ public static Element addElement(Document doc, Node parent, String element, Object textValue) { Element elem = doc.createElement(element); if (Objects.nonNull(textValue)) { elem.setTextContent(String.valueOf(textValue)); } parent.appendChild(elem); return elem; } }