Java tutorial
//package com.java2s; import org.w3c.dom.*; public class Main { /** * 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; } }