Here you can find the source of getElementByTagName(Element current, String name)
public static Element getElementByTagName(Element current, String name)
//package com.java2s; //License from project: Apache License import org.w3c.dom.Element; import org.w3c.dom.NodeList; public class Main { public static Element getElementByTagName(Element current, String name) { return getElementByTagName(current, name, null); }// w w w . j a v a 2 s.c o m public static Element getElementByTagName(Element current, String name, String namespace) { NodeList elements = null; if (namespace == null) elements = current.getElementsByTagName(name); else elements = current.getElementsByTagNameNS(namespace, name); if (elements == null) return null; if (elements.getLength() != 1) return null; return (Element) elements.item(0); } }