Here you can find the source of getChild(Element node, String tagName)
public static Element getChild(Element node, String tagName)
//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 Element getChild(Element node, String tagName) { Element element = null;/*from w w w . j a v a 2 s . co m*/ do { if (node == null) { break; } NodeList childNodes = node.getChildNodes(); for (int i = 0; i < childNodes.getLength(); i++) { Node child = childNodes.item(i); if (child.getNodeType() == Node.ELEMENT_NODE) { if (child.getNodeName().equals(tagName)) { element = (Element) child; break; } } } } while (false); return element; } }