Java examples for XML:DOM Document
Add a Text element to XML Document
//package com.java2s; import org.w3c.dom.*; public class Main { /** Add a Text element to a Document */ public static Text addChildTextElement(Document doc, Node parent, String tag, String value) { Element e = doc.createElement(tag); Text t = doc.createTextNode(value); e.appendChild(t);/* w ww. j a va 2 s.co m*/ parent.appendChild(e); return t; } }