String nn = current.getLocalName();
if (cn == null) { cn = current.getNodeName(); } String nn = node.getLocalName(); if (nn == null) { nn = node.getNodeName(); }
  boolean countMatches(Node current, Node node)  {    if (count == null)      {        int cnt = current.getNodeType();        int nnt = node.getNodeType();        if (cnt != nnt)          {            return false;          }        if (nnt == Node.ELEMENT_NODE || nnt == Node.ATTRIBUTE_NODE)          {            String curi = current.getNamespaceURI();            String nuri = node.getNamespaceURI();            if ((curi == null && nuri != null) ||                (curi != null && !curi.equals(nuri)))              {                return false;              }            String cn = current.getLocalName();            String nn = current.getLocalName();            if (!cn.equals(nn))              {                return false;              }          }        return true;      }    else      {        return count.matches(node);      }  }