Java tutorial
//package com.java2s; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; public class Main { /** * Create a new element belonging to a namespace with specified text value. * * @param document * @param nodeName * @param textValue * @return created element */ public static Element createElementNS(Document document, String namespaceURI, String nodeName, String textValue) { Element element = document.createElementNS(namespaceURI, nodeName); Node textNode = document.createTextNode(textValue); element.appendChild(textNode); return element; } }