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 Element getElement(Element parentNode, String nodeName) { if (parentNode == null) { return null; } NodeList nl = parentNode.getChildNodes(); for (int i = 0; i < nl.getLength(); i++) { if (nl.item(i).getNodeType() == Node.ELEMENT_NODE) { if (nl.item(i).getNodeName().equals(nodeName)) { return (Element) nl.item(i); } } } return null; } }