Java XML Text Node Create appendElementChildWithText(Document doc, Element parent, String name, String text)

Here you can find the source of appendElementChildWithText(Document doc, Element parent, String name, String text)

Description

append Element Child With Text

License

Apache License

Declaration

public static Element appendElementChildWithText(Document doc, Element parent, String name, String text) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import org.w3c.dom.*;

public class Main {
    public static Element appendElementChildWithText(Document doc, Element parent, String name, String text) {
        Element el = appendElementChild(doc, parent, name);
        el.setTextContent(text);/*  w w  w  . j  av a 2s  . c  o  m*/
        return el;
    }

    public static Element appendElementChild(Document doc, Element parent, String name) {
        Element el = doc.createElement(name);
        parent.appendChild(el);
        return el;
    }
}

Related

  1. addTextElement(final Document document, final Element parentDom, final String namespace, final String name, final String value)
  2. addTextElement(final Document document, final Element parentDom, final String namespace, final String name, final String value)
  3. addTextNode(Document document, Element ret, String tag, String value)
  4. addTextNode(Document XMLDocument, Node rootElement, String tagName, String text)
  5. appendElementChild(Document doc, Element parent, String name)
  6. createText(Document doc, Node parent, String contents)
  7. createText(DocumentFragment fragment)
  8. createTextChildElement(Document doc, Node node, String name, String value)
  9. createTextElement(Document d, String textElementName, String textElementValue)