Here you can find the source of addTextElement(Node parent, String name, String value)
public static Element addTextElement(Node parent, String name, String value)
//package com.java2s; /*// ww w .j a va2 s. c o m * JFox - The most lightweight Java EE Application Server! * more details please visit http://www.huihoo.org/jfox or http://www.jfox.org.cn. * * JFox is licenced and re-distributable under GNU LGPL. */ import org.w3c.dom.Attr; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; public class Main { public static Element addTextElement(Node parent, String name, String value) { return addTextElement(parent, name, value, null); } public static Element addTextElement(Node parent, String name, String value, Attr[] attrs) { Element element; if (parent instanceof Document) { element = ((Document) parent).createElement(name); } else { element = parent.getOwnerDocument().createElement(name); } if (attrs != null && attrs.length > 0) { for (Attr attr : attrs) { element.setAttributeNode(attr); } } if (value != null) { element.setTextContent(value); } parent.appendChild(element); return element; } }