Java tutorial
//package com.java2s; // Licensed under the Apache License, Version 2.0 (the "License"); import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Text; public class Main { public static void addValuedElement(Document document, Element parent, String elementName, String content) { Element name = document.createElement(elementName); Text text = document.createTextNode(content); name.appendChild(text); parent.appendChild(name); } }