Java tutorial
//package com.java2s; import org.w3c.dom.Document; import org.w3c.dom.Element; public class Main { public static String getNodeValue(Document doc, String tagname) { if (doc != null) return ((Element) doc.getElementsByTagName(tagname).item(0)).getFirstChild().getNodeValue(); else return ""; } }