Example usage for org.w3c.dom Node appendChild

List of usage examples for org.w3c.dom Node appendChild

Introduction

In this page you can find the example usage for org.w3c.dom Node appendChild.

Prototype

public Node appendChild(Node newChild) throws DOMException;

Source Link

Document

Adds the node newChild to the end of the list of children of this node.

Usage

From source file:Main.java

/**
 * Add the specified node to specified parent node
 *//*from www. ja v a 2s  .co m*/
public static Node addNode(Node parent, Node node) {
    return parent.appendChild(node);
}

From source file:Main.java

public static void appendTo(Node source, Node target) {
    target.appendChild(source);
}

From source file:Main.java

/**
 * Create a property element.  Do not append it though!
 * @param doc The document to use./*from  www . j  av  a 2  s.co m*/
 * @param name The name of the property.
 * @param value The value to add to the property.
 * @return The newly created property.
 */
public static Node createProperty(final Document doc, final String name, final String value) {
    final Node n = doc.createElement(name);
    n.appendChild(doc.createTextNode(value));
    return n;
}

From source file:Main.java

public static Element addElement(Document doc, Node parent, String name) {
    Element child = doc.createElement(name);
    parent.appendChild(child);
    return child;
}

From source file:Main.java

public static Element addANode(Document doc, String name, Node parent) {
    Element e = doc.createElement(name);
    parent.appendChild(e);
    return e;//from   w  w w  . j  av a2  s.c  om
}

From source file:Main.java

public static void appendChild(Node node, Node child) {
    if (node != null && child != null) {
        node.appendChild(child);
    }//from  w  w w  . j  a va2s  .  co m
}

From source file:Main.java

public static Element addChildElement(Document doc, Node parent, String elementName) {
    Element e = doc.createElement(elementName);
    parent.appendChild(e);
    return e;//from   w w w  . j  a  v a 2s  . co m
}

From source file:Main.java

public static Element addNode(Document doc, Node parent, String name) {
    Element child = doc.createElement(name);
    parent.appendChild(child);
    return child;
}

From source file:Main.java

public static Node createTextNode(Document document, String elTag, String value) {
    Node elem = document.createElement(elTag);
    Node text = document.createTextNode(value);
    elem.appendChild(text);
    return elem;/*from ww w  .java 2  s  . co  m*/
}

From source file:Main.java

public static Element createElement(Document doc, Node parent, String tagName) {
    Element e = doc.createElement(tagName);
    parent.appendChild(e);
    return e;//from  w  w w.  j  a v a 2  s.com
}