Java tutorial
//package com.java2s; import java.util.ArrayList; import java.util.List; import org.w3c.dom.Element; import org.w3c.dom.Node; public class Main { public static List<Element> getNamedChildElements(Element parent, String name) { List<Element> elements = new ArrayList<Element>(); if (parent != null) { Node child = parent.getFirstChild(); while (child != null) { if ((child.getNodeType() == Node.ELEMENT_NODE) && (child.getNodeName().equals(name))) { elements.add((Element) child); } child = child.getNextSibling(); } } return elements; } }