Here you can find the source of getFirstNodeValue(NodeList nodeList)
public static String getFirstNodeValue(NodeList nodeList)
//package com.java2s; import org.w3c.dom.Node; import org.w3c.dom.NodeList; public class Main { public static String getFirstNodeValue(NodeList nodeList) { String nodeValue = ""; StringBuffer varBuffer = new StringBuffer(); Node node = (Node) nodeList.item(0); if (node != null) { /*if(node != null) { Node eleText = node.getFirstChild(); if(eleText != null) {/*from w w w . j a v a 2 s . co m*/ nodeValue = eleText.getNodeValue(); } }*/ NodeList childNodes = node.getChildNodes(); for (int i = 0; i < childNodes.getLength(); i++) { varBuffer.append(childNodes.item(i).getNodeValue().toString()); } } nodeValue = varBuffer.toString(); return nodeValue; } }