List of usage examples for org.w3c.dom Element 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 void addDataText1(Document doc, Node parent, String elementName, String elementData) { Element e = doc.createElement(elementName); e.appendChild(doc.createTextNode(elementData)); parent.appendChild(e);//w ww . j a v a 2 s .co m }
From source file:Main.java
private static Element createElementWithContent(Document doc, String tagName, String content) { Element node = doc.createElement(tagName); node.appendChild(doc.createTextNode(content)); return node;//from w w w . ja va 2 s . c o m }
From source file:Main.java
public static void createOptionalChildText(Document doc, Element elem, String name, String value) { if (value == null || value.length() == 0) { return;/* ww w.j av a 2s .co m*/ } Element child = doc.createElement(name); child.appendChild(doc.createTextNode(value)); elem.appendChild(child); }
From source file:Main.java
private static Node createElementWithCDATA(Document doc, String tagName, String cdata) { Element node = doc.createElement(tagName); node.appendChild(doc.createCDATASection(cdata)); return node;/*from w ww.j a va 2 s. c om*/ }
From source file:Main.java
private static Element createTextElement(String name, String value, Document document) { Element element = document.createElement(name); element.appendChild(document.createTextNode(value)); return element; }
From source file:Util.java
/** * Cre un lment avec un Text Node comme enfant. * /*w ww. j av a2 s.c o m*/ * @param doc * @param tagName * @param text * @return */ public static Element createElementWithText(final Document doc, final String tagName, final String text) { Element e = doc.createElement(tagName); e.appendChild(doc.createTextNode(text)); return e; }
From source file:Main.java
public static void addTextTag(Node node, String tagName, String text) { Document doc = node.getOwnerDocument(); Element elem = doc.createElement(tagName); elem.appendChild(doc.createTextNode(text)); node.appendChild(elem);// w ww . j a v a 2 s . c o m }
From source file:Main.java
public static final void addNodeCDATAValue(Node node, String name, String value) { if (value != null) { Document doc = node.getOwnerDocument(); Element e = doc.createElement(name); e.appendChild(doc.createCDATASection(value)); node.appendChild(e);/*from w w w.j ava2s . co m*/ } }
From source file:Main.java
/** * Creates an element representing {@code <tag>text</tag>}. * * @param doc//from w w w . j a v a 2s. c o m * The {@link Document} containing the {@link Element}. * @param tag * The tag name of the created {@link Element}. * @param text * The content of the created {@link Element}. * @return the {@link Element} created. */ public static Element createField(Document doc, String tag, String text) { Element elem = doc.createElement(tag); elem.appendChild(doc.createTextNode(text)); return elem; }
From source file:Main.java
public static final void addNodeValue(Node node, String name, String value) { if (value != null) { Document doc = node.getOwnerDocument(); Element e = doc.createElement(name); e.appendChild(doc.createTextNode(value)); node.appendChild(e);/*from www . j a v a2 s . c om*/ } }