Here you can find the source of getChildElements(Node node)
public static ArrayList<Element> getChildElements(Node node)
//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);/*from www .jav a 2 s . co m*/ } Node nextChild = childNode.getNextSibling(); childNode = nextChild; } return l; } }