Java XML NodeList to Element List toElementList(NodeList list)

Here you can find the source of toElementList(NodeList list)

Description

to Element List

License

Open Source License

Declaration

private static List<Element> toElementList(NodeList list) 

Method Source Code


//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;
    }
}

Related

  1. toElementList(NodeList nds)
  2. toElementList(NodeList nodeList)
  3. toElementList(NodeList nodeList)
  4. toElements(NodeList nl)