Here you can find the source of getTextContent(Element ele)
public static String getTextContent(Element ele)
//package com.java2s; //License from project: Open Source License import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; public class Main { public static String getTextContent(Element ele) { NodeList list = ele.getChildNodes(); for (int i = 0; i < list.getLength(); i++) { Node node = list.item(i); if (node.getNodeType() == Node.ELEMENT_NODE) { return node.getTextContent(); }// w w w . j a v a2 s . c o m } return ""; } }