Here you can find the source of getDirectChildNodes(Node node, String name)
public static List<Node> getDirectChildNodes(Node node, String name)
//package com.java2s; import java.util.LinkedList; import java.util.List; import org.w3c.dom.Node; import org.w3c.dom.NodeList; public class Main { public static List<Node> getDirectChildNodes(Node node, String name) { LinkedList<Node> nodes = new LinkedList<Node>(); NodeList childList = node.getChildNodes(); for (int childIndex = 0; childIndex < childList.getLength(); childIndex++) { Node child = childList.item(childIndex); if (child.getNodeName().equals(name)) { nodes.add(child);// ww w.jav a2 s. com } } return nodes; } }