Here you can find the source of nodeMatchesAttributeFilter(Node node, String attributeName, List
static boolean nodeMatchesAttributeFilter(Node node, String attributeName, List<String> attributeValues)
//package com.java2s; import java.util.List; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; public class Main { static boolean nodeMatchesAttributeFilter(Node node, String attributeName, List<String> attributeValues) { if (attributeName == null || attributeValues == null) { return true; }/*from www. ja va 2 s . com*/ NamedNodeMap attrMap = node.getAttributes(); if (attrMap != null) { Node attrNode = attrMap.getNamedItem(attributeName); if (attrNode != null && attributeValues.contains(attrNode.getNodeValue())) { return true; } } return false; } static String getNodeValue(Node node) { return (node == null || node.getFirstChild() == null || node .getFirstChild().getNodeValue() == null) ? null : node .getFirstChild().getNodeValue().trim(); } }