Here you can find the source of getValue(Node node)
public static String getValue(Node node)
//package com.java2s; import org.w3c.dom.Node; public class Main { public static String getValue(Node node) { StringBuffer value = new StringBuffer(); if (node != null) { int childCount = node.getChildNodes().getLength(); for (int i = 0; i < childCount; i++) { Node childNode = node.getChildNodes().item(i); switch (childNode.getNodeType()) { case Node.TEXT_NODE: case Node.CDATA_SECTION_NODE: value.append(childNode.getNodeValue()); }//from w ww.j a va 2s .c o m } } return value.toString(); } }