List of usage examples for org.w3c.dom Node appendChild
public Node appendChild(Node newChild) throws DOMException;
newChild
to the end of the list of children of this node. From source file:Main.java
public static Node addNode(Document document, Node baseNode, String newNodeName) { Node newNode = document.createElement(newNodeName); baseNode.appendChild(newNode); return newNode; }
From source file:Main.java
public static Element createNodeIn(Node aDestNode, String aNode, Document aXml) { Element element = aXml.createElement(aNode); aDestNode.appendChild(element); return element; }
From source file:Main.java
/** * Create a node with tag name./*from w ww . j a va2 s.c o m*/ * * @param document * the document * @param parent * the parent node * @param tagName * the tag name * @return the created node */ public static Element createNode(Document document, Node parent, String tagName) { Element node = document.createElement(tagName); parent.appendChild(node); return node; }
From source file:Main.java
public static Node insertNewAfter(final Document impD, final Node targetE, final Node newE) { Node impNewNode = impD.importNode(newE, true); Node parent = targetE.getParentNode(); if (targetE.getNextSibling() == null) { parent.appendChild(impNewNode); } else {// w w w . ja v a 2 s. c o m parent.insertBefore(impNewNode, targetE.getNextSibling()); } return impNewNode; }
From source file:Main.java
public static void addCDATA(Document document, Node baseNode, String value) { CDATASection cdataSection = document.createCDATASection(value); baseNode.appendChild(cdataSection); }
From source file:Main.java
/** * Add a node at the end to a node./*from w ww . j av a2 s . co m*/ * * @param doc document * @param node parent node * @param name name of node * @return new node */ public static Element addNode(Document doc, Node node, String name) { Element element = doc.createElement(name); node.appendChild(element); return element; }
From source file:Main.java
/** * Utility method to add an attribute to a given element * * @param document//from ww w . j a v a2 s . c o m * @param elementName * @param parentNode */ public static Element addChildElement(Document document, String elementName, Node parentNode) { Element elt = document.createElement(elementName); parentNode.appendChild(elt); return elt; }
From source file:Main.java
/** Add an Element to a Document */ public static Element addChildElement(Document doc, Node parent, String tag) { Element e = doc.createElement(tag); doc.importNode(e, true);//from w ww . j a v a 2s .c o m parent.appendChild(e); return e; }
From source file:Main.java
public static Node addText(Node parent, String value) { Text text = parent.getOwnerDocument().createTextNode(value); parent.appendChild(text); return text;//from w ww. ja va 2 s.co m }
From source file:Main.java
public static Node createTextElement(Document doc, String name, String content) { Node elementNode = doc.createElement(name); Node textNode = doc.createTextNode(content); elementNode.appendChild(textNode); return elementNode; }