Java examples for XML:XML Element Child
get Child Elements By Name
//package com.java2s; import java.util.ArrayList; import java.util.List; import org.w3c.dom.Node; public class Main { public static List<Node> getChildElementsByName(Node element, String name) {/*w w w . j av a 2s . c o m*/ ArrayList<Node> childList = new ArrayList<Node>(); for (int i = 0; i < element.getChildNodes().getLength(); i++) { Node child = element.getChildNodes().item(i); if (Node.ELEMENT_NODE == child.getNodeType() && name.equals(name)) { childList.add(child); } } return childList; } }