Here you can find the source of getElementByTagName(Element parent, String elementName)
public static final Element getElementByTagName(Element parent, String elementName)
//package com.java2s; import org.w3c.dom.Element; import org.w3c.dom.NodeList; public class Main { public static final Element getElementByTagName(Element parent, String elementName) { NodeList nodeList = parent.getElementsByTagName(elementName); if (nodeList.getLength() > 0) { return (Element) nodeList.item(0); }// ww w . j a v a2s . c om return null; } }