Java tutorial
//package com.java2s; import java.util.ArrayList; import java.util.List; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; public class Main { public static List<Element> getChildren(Element parent) { NodeList children = parent.getChildNodes(); final int length = children.getLength(); ArrayList<Element> elements = new ArrayList<Element>(); for (int index = 0; index < length; index++) { Node node = children.item(index); if (node.getNodeType() != Node.ELEMENT_NODE) { continue; } elements.add((Element) node); } return elements; } }