Java tutorial
//package com.java2s; import java.util.ArrayList; import org.w3c.dom.Node; public class Main { /** * Returns a list of all child nodes * @param node * @return */ public static ArrayList<Node> getAllChildren(Node node) { ArrayList<Node> list = new ArrayList<Node>(); if (node == null) return list; for (Node child = node.getFirstChild(); child != null; child = child.getNextSibling()) { list.add(child); } return list; } }