Java tutorial
//package com.java2s; import org.w3c.dom.Node; import org.w3c.dom.Text; public class Main { public static String getChildNodeText(Node node, String pathname) { Node childNode = getChildNode(node, pathname); if (childNode != null) { Text bb = (Text) childNode.getChildNodes().item(0); return bb.getNodeValue(); } return ""; } public static Node getChildNode(Node node, String pathname) { if (node != null && node.getChildNodes() != null && node.getChildNodes().getLength() > 0) { for (int a = 0; a < node.getChildNodes().getLength(); a++) { if (pathname.equals(node.getChildNodes().item(a).getNodeName())) { return node.getChildNodes().item(a); } } } return null; } }