Java tutorial
//package com.java2s; import org.w3c.dom.Node; import org.w3c.dom.NodeList; public class Main { public static String getValueByNodeName(Node parentNode, String nodeName) { NodeList nodeList = parentNode.getChildNodes(); for (int i = 0; i < nodeList.getLength(); i++) { if (nodeList.item(i).getNodeName().equalsIgnoreCase(nodeName)) { return nodeList.item(i).getTextContent(); } } return null; } }