Java tutorial
//package com.java2s; import org.w3c.dom.Element; import org.w3c.dom.Node; import java.util.ArrayList; public class Main { public static ArrayList<Element> getChildElements(Node node) { ArrayList<Element> l = new ArrayList<Element>(); for (Node childNode = node.getFirstChild(); childNode != null;) { if (childNode.getNodeType() == Node.ELEMENT_NODE) { Element elem = (Element) childNode; l.add(elem); } Node nextChild = childNode.getNextSibling(); childNode = nextChild; } return l; } }