Here you can find the source of getChildElements(Node node)
public static List<Element> getChildElements(Node node)
//package com.java2s; // modify it under the terms of the GNU General Public License 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 { /** Return a list of the elements that are direct children of the given * node.//from ww w. j a v a 2 s . c o m */ public static List<Element> getChildElements(Node node) { NodeList childNodes = node.getChildNodes(); List result = new ArrayList(childNodes.getLength()); for (int i = 0; i < childNodes.getLength(); i++) { Node oneChild = childNodes.item(i); if (oneChild instanceof Element) result.add(oneChild); } return result; } }