Here you can find the source of getChildElementsByName(Element parent, String name)
public static List<Element> getChildElementsByName(Element parent, String name)
//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<Element> getChildElementsByName(Element parent, String name) {/*from w w w . j av a 2 s . co m*/ List<Element> result = new ArrayList<Element>(); NodeList childNodes = parent.getChildNodes(); for (int i = 0; i < childNodes.getLength(); i++) { Node child = childNodes.item(i); if (child.getNodeType() != Node.ELEMENT_NODE) { continue; } String nodeName = child.getNodeName(); if (name.equals(nodeName.trim())) { result.add((Element) child); } } return result; } }