Java examples for XML:XML Element Child
get XML Children Of Name
//package com.java2s; import java.util.ArrayList; import java.util.List; import org.w3c.dom.Node; import org.w3c.dom.NodeList; public class Main { public static List<Node> getChildrenOfName(Node node, String name) { List<Node> res = new ArrayList<Node>(); NodeList childNodes = node.getChildNodes(); for (int i = 0; i < childNodes.getLength(); i++) { Node item = childNodes.item(i); String localName = item.getNodeName(); if (name.equals(localName)) { res.add(item);/*from w ww .j av a 2s . c o m*/ } } return res; } }