Here you can find the source of getSimpleElementText(Element node)
public static String getSimpleElementText(Element node)
//package com.java2s; //License from project: Open Source License import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.w3c.dom.Text; public class Main { public static String getSimpleElementText(Element node) { if (node == null) return null; StringBuffer sb = new StringBuffer(); NodeList children = node.getChildNodes(); for (int i = 0; i < children.getLength(); i++) { Node child = children.item(i); if (child instanceof Text) { sb.append(child.getNodeValue()); }//from w ww .ja v a 2 s . c o m } return sb.toString(); } }