Here you can find the source of addChild(Node parent, String name, String text)
private static void addChild(Node parent, String name, String text)
//package com.java2s; //License from project: Apache License import org.w3c.dom.Element; import org.w3c.dom.Node; public class Main { /**/*from w w w.ja v a 2s . c o m*/ * Utility method for adding text nodes. */ private static void addChild(Node parent, String name, String text) { Element child = parent.getOwnerDocument().createElement(name); child.appendChild(parent.getOwnerDocument().createTextNode(text)); parent.appendChild(child); } }