Here you can find the source of selectNode(Node node, String tag)
public static Node selectNode(Node node, String tag)
//package com.java2s; //License from project: Open Source License import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; public class Main { public static Node selectNode(Node node, String tag) { NodeList nodes = node.getChildNodes(); for (int i = 0; i < nodes.getLength(); i++) { Node n = nodes.item(i); if (n instanceof Element && ((Element) n).getTagName().equals(tag)) { return n; }//from w w w .j a v a2 s .co m } return null; } }