Here you can find the source of readFirstChild(Node parentNode, String nodeName)
public static Element readFirstChild(Node parentNode, String nodeName)
//package com.java2s; //License from project: Apache License import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; public class Main { public static Element readFirstChild(Node parentNode, String nodeName) { if (parentNode != null) { NodeList children = parentNode.getChildNodes(); for (int i = 0; i < children.getLength(); i++) { if (children.item(i).getNodeName().equals(nodeName)) return (Element) children.item(i); }//from w ww . ja v a 2 s .c o m } return null; } }