Java tutorial
//package com.java2s; import org.w3c.dom.*; public class Main { public static final String getData(Node node) { Element e = (Element) node; NodeList childNodes = e.getChildNodes(); Text text = (Text) childNodes.item(0); return (text != null) ? text.getData() : ""; } }