Here you can find the source of createTextElement(Document doc, String elementName, String value)
public static Element createTextElement(Document doc, String elementName, String value)
//package com.java2s; //License from project: Open Source License import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Text; public class Main { public static Element createTextElement(Document doc, String elementName, String value) { Element element = doc.createElement(elementName); Text text = doc.createTextNode(value); element.appendChild(text);//from www . j a v a 2 s . c o m return element; } }