Here you can find the source of getChildElements(Node node)
static public List<Element> getChildElements(Node node)
//package com.java2s; //License from project: Open Source License import java.util.ArrayList; import java.util.List; import org.w3c.dom.NodeList; import org.w3c.dom.Node; import org.w3c.dom.Element; public class Main { static public List<Element> getChildElements(Node node) { ArrayList<Element> list = new ArrayList<Element>(); NodeList nl = node.getChildNodes(); for (int i = 0; i < nl.getLength(); i++) { Node n = nl.item(i);//from w w w. ja va 2 s.c o m if (n.getNodeType() == Node.ELEMENT_NODE) { list.add((Element) nl.item(i)); } } return list; } }