Java XML Text Node Create createTextElement(Document doc, String name, String content)

Here you can find the source of createTextElement(Document doc, String name, String content)

Description

create Text Element

License

Open Source License

Declaration

public static Node createTextElement(Document doc, String name, String content) 

Method Source Code

//package com.java2s;
/*/*from  w  ww.  j  a  v  a2s. c  o m*/
 * Keystone Development Framework
 * Copyright (C) 2004-2009 Rick Knowles
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public License
 * Version 2 as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License Version 2 for more details.
 *
 * You should have received a copy of the GNU Library General Public License
 * Version 2 along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 */

import org.w3c.dom.Document;

import org.w3c.dom.Node;

public class Main {
    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;
    }
}

Related

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