Here you can find the source of getFirstChild(Element tag, String childTagName)
public static Element getFirstChild(Element tag, String childTagName)
//package com.java2s; // are made available under the terms of the Eclipse Public License v1.0 import org.w3c.dom.Element; import org.w3c.dom.NodeList; public class Main { public static Element getFirstChild(Element tag, String childTagName) { NodeList nodes = tag.getElementsByTagName(childTagName); if (nodes == null || nodes.getLength() == 0) { return null; }/*from w ww .j a v a2 s. c o m*/ return (Element) nodes.item(0); } }