Here you can find the source of getElementValue(Node elem)
public static String getElementValue(Node elem)
//package com.java2s; import org.w3c.dom.Node; public class Main { public static String getElementValue(Node elem) { Node child;// w w w .j av a 2 s .co m if (elem != null) { if (elem.hasChildNodes()) { for (child = elem.getFirstChild(); child != null; child = child .getNextSibling()) { if (child.getNodeType() == Node.TEXT_NODE) { return child.getNodeValue(); } } } } return ""; } }