Java XML Text Node Create addTextElement(Document doc, String name, String value, Element parent)

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

Description

add Text Element

License

Open Source License

Declaration

public static Element addTextElement(Document doc, String name,
            String value, Element parent) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import org.w3c.dom.Document;
import org.w3c.dom.Element;

public class Main {
    public static Element addTextElement(Document doc, String name,
            String value, Element parent) {
        Element child = doc.createElement(name);
        child.appendChild(doc.createTextNode(value));
        parent.appendChild(child);//from  ww  w .ja  v  a 2s .c  om
        return child;
    }
}

Related

  1. addText(Document doc, Node node, String text)
  2. addText(Document doc, Node parent, String data)
  3. addTextElement(Document document, Node parentNode, String elementName, String elementText)
  4. addTextElement(final Document document, final Element parentDom, final String namespace, final String name, final String value)
  5. addTextElement(final Document document, final Element parentDom, final String namespace, final String name, final String value)
  6. addTextNode(Document document, Element ret, String tag, String value)