Java XML Text Node Create createTextElement(Document doc, String elementName, String value)

Here you can find the source of createTextElement(Document doc, String elementName, String value)

Description

create Text Element

License

Open Source License

Declaration

public static Element createTextElement(Document doc, String elementName, String value) 

Method Source Code

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

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

import org.w3c.dom.Text;

public class Main {
    public static Element createTextElement(Document doc, String elementName, String value) {
        Element element = doc.createElement(elementName);
        Text text = doc.createTextNode(value);
        element.appendChild(text);//from  www  .  j a v a 2 s  .  c  o  m
        return element;
    }
}

Related

  1. appendElementChildWithText(Document doc, Element parent, String name, String text)
  2. createText(Document doc, Node parent, String contents)
  3. createText(DocumentFragment fragment)
  4. createTextChildElement(Document doc, Node node, String name, String value)
  5. createTextElement(Document d, String textElementName, String textElementValue)
  6. createTextElement(Document doc, String name, String content)
  7. createTextElement(final Document document, final String tagName, final String text)
  8. createTextElement(QName qname, String value, Document doc)
  9. createTextLn(Document d, String text)