Java XML Text Node Create addText(Document doc, Node parent, String data)

Here you can find the source of addText(Document doc, Node parent, String data)

Description

add Text

License

Open Source License

Declaration

public static void addText(Document doc, Node parent, String data) 

Method Source Code

//package com.java2s;
/**/*from   w  w  w.  j  ava2  s  .com*/
 * Copyright (c) 2014-2016 by Wen Yu.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 * 
 * Any modifications to this file must keep this entire header intact.
 * 
 * Change History - most recent changes go on top of previous changes
 *
 * StringUtils.java
 *
 * Who   Date       Description
 * ====  =========  =====================================================
 * WY    29Apr2015  Renamed findAttribute() to getAttribute()
 * WY    09Apr2015  Added null check to findAttribute()
 * WY    03Mar2015  Added serializeToString() and serializeToByteArray()
 * WY    27Feb2015  Added findAttribute() and removeAttribute()
 * WY    23Jan2015  Initial creation - moved XML related methods to here
 */

import org.w3c.dom.Document;

import org.w3c.dom.Node;

public class Main {
    public static void addText(Document doc, Node parent, String data) {
        parent.appendChild(doc.createTextNode(data));
    }
}

Related

  1. addText(Document doc, Node node, String text)
  2. addTextElement(Document doc, String name, String value, Element parent)
  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)