Here you can find the source of getNode(Node node, String nodeName)
public static Node getNode(Node node, String nodeName)
//package com.java2s; //License from project: Open Source License import java.util.ArrayList; import java.util.List; import org.w3c.dom.Node; import org.w3c.dom.NodeList; public class Main { public static Node getNode(Node node, String nodeName) { List<Node> childList = getChildNodesByName(node, nodeName); if (childList.size() > 0) { return childList.get(0); } else {//ww w.ja v a 2 s. com return null; } } public static List<Node> getChildNodesByName(Node node, String name) { List<Node> result = new ArrayList<Node>(); NodeList childList = node.getChildNodes(); for (int i = 0; i < childList.getLength(); ++i) { Node child = childList.item(i); if (child.getNodeName().equals(name)) { result.add(child); } } return result; } }