Here you can find the source of getElementValue(Element element, String tag)
public static String getElementValue(Element element, String tag)
//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 getElementValue(Element element, String tag) { Element by = getElement(element, tag); if (!(by == null)) { return by.getFirstChild().getNodeValue(); }//from ww w .j ava 2 s . co m return null; } public static Element getElement(Node node, String tag) { if (!node.hasChildNodes()) return null; NodeList list = node.getChildNodes(); for (int i = 0; i < list.getLength(); i++) { Node item = list.item(i); if (item instanceof Element) { Element element = (Element) item; if (element.getTagName().equals(tag)) return element; } } return null; } }