Here you can find the source of children(Node x)
public static ArrayList<Element> children(Node x)
//package com.java2s; import java.util.ArrayList; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; public class Main { public static ArrayList<Element> children(Node x) { ArrayList<Element> a = new ArrayList<Element>(); NodeList nodeList = x.getChildNodes(); for (int i = 0; i < nodeList.getLength(); i++) { Node n = nodeList.item(i); if (n.getNodeType() == Node.ELEMENT_NODE) { a.add((Element) n); }/*from ww w .ja v a 2 s. c o m*/ } return a; } }