Java tutorial
//package com.java2s; import java.util.LinkedList; import java.util.List; import org.w3c.dom.Node; import org.w3c.dom.NodeList; public class Main { /** * @param node * @param name * @return all children nodes with the given name */ public static List<Node> findChildren(Node node, String name) { List<Node> ret = new LinkedList<Node>(); NodeList nl = node.getChildNodes(); int len = nl.getLength(); Node child; for (int i = 0; i < len; i++) { child = nl.item(i); if (name.equals(child.getNodeName())) { ret.add(child); } } return ret; } }