Here you can find the source of toElementList(NodeList list)
private static List<Element> toElementList(NodeList list)
//package com.java2s; //License from project: Open Source License 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 { private static List<Element> toElementList(NodeList list) { ArrayList<Element> nodes = new ArrayList<Element>(); for (int i = 0; i < list.getLength(); i++) { Node node = list.item(i); if (node instanceof Element) nodes.add((Element) node); }/*ww w . j av a2 s . co m*/ return nodes; } }