Here you can find the source of getNodeText(final Node node)
public static String getNodeText(final Node node)
//package com.java2s; //License from project: Open Source License import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.w3c.dom.Text; public class Main { /**/* ww w . j a v a 2 s. c o m*/ * Return the contained text within an Element. Returns null if no text found. */ public static String getNodeText(final Node node) { NodeList nl = node.getChildNodes(); for (int i = 0; i < nl.getLength(); i++) { Node c = nl.item(i); if (c instanceof Text) return ((Text) c).getData(); } return null; } }