Java XML Node Value setTextValue(Node aNode, String aValue)

Here you can find the source of setTextValue(Node aNode, String aValue)

Description

set Text Value

License

Open Source License

Parameter

Parameter Description
aNode a parameter
aValue a parameter

Declaration

public static void setTextValue(Node aNode, String aValue) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2011 www.isandlatech.com (www.isandlatech.com)
 * 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
 *
 * Contributors:/*from  w  w  w. j a va2s.  c  o m*/
 *    ogattaz (isandlaTech) - initial API and implementation
 *******************************************************************************/

import org.w3c.dom.Document;

import org.w3c.dom.Node;

import org.w3c.dom.Text;

public class Main {
    /**
     * 
     * @param aNode
     * @param aValue
     */
    public static void setTextValue(Node aNode, String aValue) {

        Document wDocument = aNode.getOwnerDocument();
        Text wText = wDocument.createTextNode(aValue);
        aNode.appendChild(wText);
    }
}

Related

  1. setText(Node node, String text)
  2. setText(Node node, String text)
  3. setText(Node node, String value)
  4. setTextContent(Node namespaceNode, String textContent)
  5. setTextContent(Node node, final String text)
  6. setTextValue(Node node, String newValue)
  7. setTextValue(Node node, String value)
  8. setValueOfNode(Node node, String value)
  9. xmlGetFirstTextValue(Node node)