Java tutorial
//package com.java2s; import org.w3c.dom.*; public class Main { public static String getText(Node node) { String value = ""; NodeList children = node.getChildNodes(); for (int k = 0; k < children.getLength(); k++) { Node child = children.item(k); if (child.getNodeType() == Node.TEXT_NODE) { value = child.getNodeValue(); } } return value; } }