Here you can find the source of toList(final NodeList nodeList)
Parameter | Description |
---|---|
nodeList | the node list |
public static List<Node> toList(final NodeList nodeList)
//package com.java2s; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import java.util.ArrayList; import java.util.List; public class Main { /**/* w w w . ja v a 2 s . c om*/ * Turns a NodeList into a list. * * @param nodeList the node list * @return list list */ public static List<Node> toList(final NodeList nodeList) { final List<Node> list = new ArrayList<Node>(nodeList.getLength()); for (int nlIndex = 0; nlIndex < nodeList.getLength(); nlIndex++) { list.add(nodeList.item(nlIndex)); } return list; } }