Java tutorial
//package com.java2s; //License from project: Open Source 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> matches = new ArrayList<Node>(); for (int x = 0; x < nodes.getLength(); x++) { Node node = nodes.item(x); if (node.getNodeName().equalsIgnoreCase(tagName)) { matches.add(node); } } return matches; } }