Java tutorial
//package com.java2s; //License from project: GNU General Public License import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; public class Main { public static Element getChildWithAttributeValue(Element parent, String attrName, String attrValue) { NodeList childNodes = parent.getChildNodes(); for (int i = 0; i < childNodes.getLength(); i++) { Node node = childNodes.item(i); if (node instanceof Element) { Element element = (Element) node; if (attrValue.equals(element.getAttribute(attrName))) { return element; } } } return null; } }