Here you can find the source of xmlNodeGetValue(Node node)
Parameter | Description |
---|---|
node | the node |
public static String xmlNodeGetValue(Node node)
//package com.java2s; //License from project: Open Source License import org.w3c.dom.Node; import org.w3c.dom.NodeList; public class Main { /**//from w w w . j a va 2 s .c o m * Xml node get value. * * @param node the node * * @return the string */ public static String xmlNodeGetValue(Node node) { NodeList list = node.getChildNodes(); int len = list.getLength(); if (len > 1) System.err.println(" Error: length of node=" + len + " for tag <" + node.getNodeName() + ">"); for (int i = 0; i < len; i++) { Node n = list.item(i); // System.out.println ( " " + i + "> name=" + n.getNodeName() + ", value=" // + // n.getNodeValue () + ", type=" + n.getNodeType() ); if (n.getNodeType() == Node.TEXT_NODE) { return (n.getNodeValue()); } } return (null); // not found } }