Java tutorial
//package com.java2s; import org.w3c.dom.*; public class Main { private static boolean hasElementWithAttribute(NodeList nodeList, String attributeName, String attributeValue) { for (int i = 0; i < nodeList.getLength(); i++) { if (attributeValue.equals(((Element) nodeList.item(i)).getAttribute(attributeName))) { return true; } } return false; } }