Here you can find the source of getElements(Element root, String element)
public static List<Element> getElements(Element root, String element)
//package com.java2s; import java.util.*; import org.w3c.dom.*; public class Main { public static List<Element> getElements(Element root, String element) { NodeList list = root.getElementsByTagName(element); List<Element> ret = new ArrayList<>(list.getLength()); for (int i = 0; i < list.getLength(); i++) { ret.add((Element) list.item(i)); }//from w w w .j a va2 s . co m return ret; } }