Java tutorial
//package com.java2s; //License from project: Open Source License import java.util.ArrayList; import java.util.Arrays; import java.util.List; import org.w3c.dom.Node; import org.w3c.dom.NodeList; public class Main { static List<Node> children(Node parent, String childNS, String... childLocalName) { List<String> childNames = Arrays.asList(childLocalName); ArrayList<Node> result = new ArrayList<Node>(); NodeList children = parent.getChildNodes(); for (int i = 0; i < children.getLength(); i++) { Node child = children.item(i); if (childNS.equals(child.getNamespaceURI()) && childNames.contains(child.getLocalName())) { result.add(child); } } return result; } }