Here you can find the source of findChildElementWithAttribute(Element parent, String name, String attribute, String value)
public static Element findChildElementWithAttribute(Element parent, String name, String attribute, String value)
//package com.java2s; import org.w3c.dom.Element; public class Main { public static Element findChildElementWithAttribute(Element parent, String name, String attribute, String value) { if (parent == null) { return null; }// w ww. ja v a 2 s . co m org.w3c.dom.Node ret = parent.getFirstChild(); while (ret != null && (!(ret instanceof Element) || !ret.getNodeName().equals(name) || ((Element) ret).getAttribute(attribute) == null || !((Element) ret) .getAttribute(attribute).equals(value))) { ret = ret.getNextSibling(); } return (Element) ret; } }