Here you can find the source of getNodesByName(String name, NodeList nodeList)
Parameter | Description |
---|---|
name | a parameter |
nodeList | a parameter |
static ArrayList<Node> getNodesByName(String name, NodeList nodeList)
//package com.java2s; //License from project: Apache License import java.util.ArrayList; import org.w3c.dom.Node; import org.w3c.dom.NodeList; public class Main { /**/*from w ww . j a va2 s . c o m*/ * Gets all nodes with a specific name * @param name * @param nodeList * @return */ static ArrayList<Node> getNodesByName(String name, NodeList nodeList) { ArrayList<Node> nodes = new ArrayList<Node>(); for (int i = 0; i < nodeList.getLength(); i++) { if (nodeList.item(i).getNodeName().equals(name)) { nodes.add(nodeList.item(i)); } } return nodes; } }