Here you can find the source of getTextValue(Element element, String name)
public static String getTextValue(Element element, String name)
//package com.java2s; // Released under the terms of the CPL Common Public License version 1.0. import org.w3c.dom.*; public class Main { public static String getTextValue(Element element, String name) { Element namedElement = getElementByTagName(element, name); return getElementText(namedElement); }//from w w w .j a v a 2 s . c o m public static Element getElementByTagName(Element element, String name) { NodeList nodes = element.getElementsByTagName(name); if (nodes.getLength() == 0) return null; else return (Element) nodes.item(0); } public static String getElementText(Element namedElement) { if (namedElement == null) { return null; } String text = namedElement.getTextContent(); return (text.isEmpty()) ? null : text; } }