Here you can find the source of getValue(Element item, String str)
public static String getValue(Element item, String str)
//package com.java2s; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; public class Main { public static String getValue(Element item, String str) { NodeList n = item.getElementsByTagName(str); return getElementValue(n.item(0)); }/*from ww w.j a v a 2 s.co m*/ public static String getElementValue(Node elem) { Node child; if (elem != null) { if (elem.hasChildNodes()) { for (child = elem.getFirstChild(); child != null; child = child .getNextSibling()) { if (child.getNodeType() == Node.TEXT_NODE) { return child.getNodeValue(); } } } } return ""; } }