Here you can find the source of getChildElementsByTagName(Element ele, String childEleName)
public static List<Node> getChildElementsByTagName(Element ele, String childEleName)
//package com.java2s; import java.util.ArrayList; import java.util.List; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; public class Main { public static List<Node> getChildElementsByTagName(Element ele, String childEleName) { NodeList nl = ele.getChildNodes(); List<Node> childEles = new ArrayList<Node>(); for (int i = 0; i < nl.getLength(); i++) { Node node = nl.item(i); if (node instanceof Element && childEleName.equals(node.getNodeName()) || childEleName.equals(node.getLocalName())) { childEles.add(node);//w w w.j a v a 2 s.c om } } return childEles; } }