Here you can find the source of matches(Node node, String requiredLocalName, QName requiredNamespace)
public static boolean matches(Node node, String requiredLocalName, QName requiredNamespace)
//package com.java2s; //License from project: Apache License import org.w3c.dom.*; import javax.xml.namespace.QName; public class Main { public static boolean matches(Node node, String requiredLocalName, QName requiredNamespace) { if (node == null) { return false; }/*from w w w .ja v a 2 s. com*/ boolean matchingNamespace = matchingNamespace(node, requiredNamespace); return matchingNamespace && matchingLocalName(node, requiredLocalName); } private static boolean matchingNamespace(Node node, QName requiredNamespace) { if (requiredNamespace == null) { return true; } else { return requiredNamespace.getNamespaceURI().equals(node.getNamespaceURI()); } } private static boolean matchingLocalName(Node node, String requiredLocalName) { if (requiredLocalName == null) { return true; } else { String localName = node.getLocalName(); return requiredLocalName.equals(localName); } } }