Java XML NodeList getNodes(String tagName, NodeList nodes)

Here you can find the source of getNodes(String tagName, NodeList nodes)

Description

get Nodes

License

Apache License

Declaration

public static List<Node> getNodes(String tagName, NodeList nodes) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.util.ArrayList;
import java.util.List;

import org.w3c.dom.Node;
import org.w3c.dom.NodeList;

public class Main {
    public static List<Node> getNodes(String tagName, NodeList nodes) {
        List<Node> nodeList = new ArrayList<Node>();
        for (int x = 0; x < nodes.getLength(); x++) {
            Node node = nodes.item(x);
            if (node.getNodeName().equalsIgnoreCase(tagName)) {
                nodeList.add(node);//  w w  w .  j  a v  a 2 s .c o  m
            }
        }
        return nodeList;
    }
}

Related

  1. getNodeList(NodeList nodeList)
  2. getNodeListAsList(NodeList nl)
  3. getNodeListByName(Node node, String name, List finalNodeList)
  4. getNodeListItems(NodeList nodeList)
  5. getNodeListLength(NodeList list)
  6. getNodesByName(String name, NodeList nodeList)
  7. getNodesOfType(NodeList list, short type)
  8. getNodeTrimValue(NodeList nodeList)
  9. getNodeValue(NodeList nodes)