Here you can find the source of getFirstChildOfTagName(Element elem, String name)
static Element getFirstChildOfTagName(Element elem, String name)
//package com.java2s; /* it under the terms of the GNU General Public License as published by */ import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; public class Main { static Element getFirstChildOfTagName(Element elem, String name) { NodeList nodeList = elem.getChildNodes(); if (nodeList == null) { return null; }// www .j av a2s . c o m for (int i = 0; i < nodeList.getLength(); i++) { Node node = nodeList.item(i); if (node instanceof Element) { elem = (Element) node; if (elem.getTagName().equals(name)) { return elem; } } } return null; } }