Java tutorial
//package com.java2s; //License from project: Open Source License import org.w3c.dom.Document; import org.w3c.dom.Node; public class Main { public static Node addTag(Document doc, Node e, String index, String value) { org.w3c.dom.Element tag = doc.createElement(index); tag.appendChild(doc.createTextNode(value)); return e.appendChild(tag); } public static Node addTag(Document doc, String index, String value) { org.w3c.dom.Element tag = doc.createElement(index); tag.appendChild(doc.createTextNode(value)); return doc.appendChild(tag); } }