Here you can find the source of getChildElements(final Element elem)
public static List<Element> getChildElements(final Element elem)
//package com.java2s; //License from project: Open Source License import java.util.List; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import com.google.common.collect.Lists; public class Main { public static List<Element> getChildElements(final Element elem) { final NodeList list = elem.getChildNodes(); final List<Element> result = Lists.newArrayList(); for (int i = 0; i < list.getLength(); i++) { final Node node = list.item(i); if (node instanceof Element) { result.add((Element) node); }//from w w w . j a v a 2s.c o m } return result; } public static List<Node> getChildNodes(final Node node) { final NodeList list = node.getChildNodes(); final List<Node> result = Lists.newArrayList(); for (int i = 0; i < list.getLength(); i++) { final Node child = list.item(i); result.add(child); } return result; } }