Here you can find the source of copyNodeList(NodeList nodeList)
Parameter | Description |
---|---|
nodeList | Node List. |
public static List<Node> copyNodeList(NodeList nodeList)
//package com.java2s; //License from project: Open Source License import org.w3c.dom.Node; import org.w3c.dom.NodeList; import java.util.*; public class Main { /**/* w w w .j a v a 2 s . co m*/ * Copy a given NodeList into a List<Element> * * @param nodeList Node List. * @return List with the elements of nodeList. */ public static List<Node> copyNodeList(NodeList nodeList) { ArrayList<Node> copy = new ArrayList<Node>(); int length = nodeList.getLength(); for (int i = 0; i < length; i++) { copy.add((Node) nodeList.item(i)); } return copy; } }