Java tutorial
//package com.java2s; import org.w3c.dom.Element; import org.w3c.dom.NodeList; public class Main { public static String getSingleValue(Element e, String s) { String value = null; NodeList nodeList = e.getElementsByTagName(s); if (nodeList.getLength() > 0) { Element _e = (Element) nodeList.item(0); NodeList eValue = _e.getChildNodes(); if (eValue.getLength() > 0) { value = eValue.item(0).getNodeValue(); } } return value; } }