Here you can find the source of getChildElements(Element parent, String localName)
public static List<Element> getChildElements(Element parent, String localName)
//package com.java2s; //License from project: LGPL 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> getChildElements(Element parent, String localName) {/* ww w. j a v a 2 s. c o m*/ List<Element> elems = new ArrayList<Element>(); NodeList nodes = parent.getChildNodes(); for (int i = 0; i < nodes.getLength(); i++) { Node node = nodes.item(i); if (node.getNodeType() == Node.ELEMENT_NODE && node.getLocalName().equals(localName)) { elems.add((Element) node); } } return elems; } }