Here you can find the source of appendElementChildWithText(Document doc, Element parent, String name, String text)
public static Element appendElementChildWithText(Document doc, Element parent, String name, String text)
//package com.java2s; //License from project: Apache License import org.w3c.dom.*; public class Main { public static Element appendElementChildWithText(Document doc, Element parent, String name, String text) { Element el = appendElementChild(doc, parent, name); el.setTextContent(text);/* w w w . j av a 2s . c o m*/ return el; } public static Element appendElementChild(Document doc, Element parent, String name) { Element el = doc.createElement(name); parent.appendChild(el); return el; } }