Here you can find the source of findNode(Node node, String attr, String value)
public static Node findNode(Node node, String attr, String value)
//package com.java2s; import org.w3c.dom.Element; import org.w3c.dom.Node; public class Main { /**/*from ww w .j a v a2 s.c o m*/ * Returns the first node where attr equals value. This implementation does * not use XPath. */ public static Node findNode(Node node, String attr, String value) { String tmp = (node instanceof Element) ? ((Element) node) .getAttribute(attr) : null; if (tmp != null && tmp.equals(value)) { return node; } node = node.getFirstChild(); while (node != null) { Node result = findNode(node, attr, value); if (result != null) { return result; } node = node.getNextSibling(); } return null; } }