Java tutorial
//package com.java2s; import org.w3c.dom.*; import java.util.LinkedList; import java.util.List; public class Main { public static List<Element> getElementsByTagName(Element element, String name) { List<Element> elements = new LinkedList<Element>(); NodeList nodeList = element.getElementsByTagName(name); for (int i = 0; i < nodeList.getLength(); i++) { elements.add((Element) nodeList.item(i)); } return elements; } }