Java tutorial
//package com.java2s; //License from project: Apache License import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; public class Main { public static Node createNode(Document document, String nodeName, String nodeValue) throws Exception { Element nodeElement = document.createElement("Property"); nodeElement.setAttribute("name", nodeName); Element nodeValueElement = document.createElement("Value"); nodeValueElement.setTextContent(nodeValue); nodeElement.appendChild(nodeValueElement); return nodeElement; } }