Here you can find the source of hasAttributeValue(String expected, String attribute, Element element)
public static boolean hasAttributeValue(String expected, String attribute, Element element)
//package com.java2s; //License from project: Open Source License import org.w3c.dom.*; public class Main { public static boolean hasAttributeValue(String expected, String attribute, Element element) { Node node = getAttributeOrNull(attribute, element); return node != null && expected.equals(node.getTextContent()); }// w w w .j av a 2s .c o m public static Node getAttributeOrNull(String attribute, Element element) { if (!element.hasAttributes()) { return null; } NamedNodeMap attributes = element.getAttributes(); return attributes.getNamedItem(attribute); } }