Here you can find the source of getFirstChildByTagName(Element parent, String tagName)
public static Element getFirstChildByTagName(Element parent, String tagName)
//package com.java2s; //License from project: LGPL import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; public class Main { public static Element getFirstChildByTagName(Element parent, String tagName) { NodeList nodes = parent.getChildNodes(); for (int i = 0; i < nodes.getLength(); i++) { Node node = nodes.item(i); if (node.getNodeType() == Node.ELEMENT_NODE && node.getNodeName().equals(tagName)) { return (Element) node; }//from w w w . jav a 2 s.c o m } return null; } }