Node.js examples for DOM:Node
Utility function for creating a node
/**/* w w w . ja v a 2s . c om*/ * Utility function for creating a node * @param namespace * @param tag * @param attName * @param attValue * @param text * @return - created node */ function createNodeStructure(namespace, tag, attName, attValue, text) { var n = document.createElementNS(namespace, tag); if (attName != null && attValue != null) { n.setAttribute(attName, attValue); } if (text != null) { n.appendChild(document.createTextNode(text)); } return n; }