Java tutorial
//package com.java2s; import java.util.*; import org.w3c.dom.*; public class Main { public static List getChildrenElement(Node n, String childTagName) { List lst = new ArrayList(); NodeList nl = n.getChildNodes(); for (int i = 0; i < nl.getLength(); i++) { Node cn = nl.item(i); if ((cn.getNodeType() == Node.ELEMENT_NODE) && (cn.getNodeName().equals(childTagName))) { lst.add(cn); } } return lst; } public static List getChildrenElement(Node n) { List lst = new ArrayList(); NodeList nl = n.getChildNodes(); for (int i = 0; i < nl.getLength(); i++) { Node cn = nl.item(i); if (cn.getNodeType() == Node.ELEMENT_NODE) { lst.add(cn); } } return lst; } }