Java tutorial
//package com.java2s; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; public class Main { public static Node getGrandChildNode(Element parent, String child, String grandChild) { Node grandChildNode = null; NodeList grandChildNodes = getChildElement(parent, child).getElementsByTagName(grandChild); if (grandChildNodes != null) { grandChildNode = grandChildNodes.item(0); } return grandChildNode; } public static Element getChildElement(Element parent, String child) { return (parent.getElementsByTagName(child) != null) ? (Element) parent.getElementsByTagName(child).item(0) : null; } }