Here you can find the source of getFirstChild(Node node, String childName)
public static Node getFirstChild(Node node, String childName)
//package com.java2s; // Written by Tomer Gabel under the Apache License Version 2.0 import org.w3c.dom.Node; import org.w3c.dom.NodeList; public class Main { public static Node getFirstChild(Node node, String childName) { NodeList nodeList = node.getChildNodes(); for (int i = 0; i < nodeList.getLength(); i++) { Node child = nodeList.item(i); if (child.getNodeName().equals(childName)) { return child; }//from w ww . j ava 2 s .c om } return null; } }