Here you can find the source of getChildText(Element element, String tag)
public static String getChildText(Element element, String tag)
//package com.java2s; //License from project: Open Source License import org.w3c.dom.Element; import org.w3c.dom.NodeList; public class Main { public static String getChildText(Element element, String tag) { String value = null;/* w ww . j a v a 2 s. c o m*/ NodeList nodeList = element.getElementsByTagName(tag); if (nodeList != null && nodeList.getLength() > 0) { Element el = (Element) nodeList.item(0); if (el.getFirstChild() != null) { value = el.getFirstChild().getNodeValue(); } } return value; } }