Here you can find the source of getTextContent(Node node)
public static String getTextContent(Node node)
//package com.java2s; //License from project: Open Source License import org.w3c.dom.Node; import org.w3c.dom.NodeList; public class Main { public static String getTextContent(Node node) { NodeList nl = node.getChildNodes(); for (int i = 0; i < nl.getLength(); i++) { if (nl.item(i).getNodeType() == Node.TEXT_NODE) return nl.item(i).getNodeValue(); }/*w w w. java 2 s . c om*/ return ""; } }