Here you can find the source of getTagValue(Node node, String name)
public static String getTagValue(Node node, String name)
//package com.java2s; //License from project: BSD License import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; public class Main { public static String getTagValue(Node node, String name) { if (node.getNodeType() == Node.ELEMENT_NODE) { Element el = (Element) node; NodeList nodeList = el.getElementsByTagName(name); if (nodeList.getLength() > 0) { el = (Element) nodeList.item(0); nodeList = el.getChildNodes(); if (nodeList.getLength() > 0) { return ((Node) nodeList.item(0)).getNodeValue(); }/* w w w . ja va 2s. co m*/ } } return ""; } }