Here you can find the source of getChild(Node node, String name)
public static Node getChild(Node node, String name)
//package com.java2s; //License from project: Apache License import org.w3c.dom.Node; import org.w3c.dom.NodeList; public class Main { public static Node getChild(Node node, String name) { if (!node.hasChildNodes()) return null; NodeList lst = node.getChildNodes(); if (lst == null) return null; for (int i = 0; i < lst.getLength(); i++) { Node child = lst.item(i); if (name.equals(child.getNodeName())) return child; }/*from ww w . j a v a 2s .c o m*/ return null; } public static Node getChild(Node node, String name, String errMsg) { Node result = getChild(node, name); if (result == null) { throw new RuntimeException(errMsg + ": missing mandatory attribute node '" + name + "'"); } return result; } }