Here you can find the source of childrenOfType(Node x, String s)
public static ArrayList<Element> childrenOfType(Node x, String s)
//package com.java2s; import java.util.ArrayList; import org.w3c.dom.Element; import org.w3c.dom.Node; public class Main { public static ArrayList<Element> childrenOfType(Node x, String s) { ArrayList<Element> a = new ArrayList<Element>(); Node n = x.getFirstChild(); Node last = x.getLastChild(); while (n != null) { if (n.getNodeName().equals(s)) { a.add((Element) n); }/* w w w. j a v a 2 s .c o m*/ if (n == last) break; n = n.getNextSibling(); } return a; } }