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