Java tutorial
//package com.java2s; //License from project: Open Source License import java.util.LinkedList; import java.util.List; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; public class Main { @SuppressWarnings("unchecked") public static List<Element> get_childs_element(Element parent, String child_name) { return (List<Element>) get_childs(parent, child_name); } public static List<? extends Node> get_childs(Node parent, String child_name) { List<Node> result = new LinkedList<Node>(); NodeList children = parent.getChildNodes(); for (int i = 0; i < children.getLength(); ++i) { Node child = children.item(i); if (child.getNodeName().equals(child_name)) result.add(child); } return result; } }