Here you can find the source of findElementByAttribute(final NodeList list, final String name, final String value)
public static Element findElementByAttribute(final NodeList list, final String name, final String value)
//package com.java2s; //License from project: GNU General Public License import org.w3c.dom.*; public class Main { public static Element findElementByAttribute(final NodeList list, final String name, final String value) { for (int i = 0; i < list.getLength(); ++i) { if (list.item(i).getNodeType() == Node.ELEMENT_NODE) { final Element e = (Element) list.item(i); if (e.hasAttribute(name) && e.getAttribute(name).equals(value)) { return e; }/*w w w . j a va2 s. c om*/ } } return null; } }