Here you can find the source of getElements(Element parentElement, String nodeName)
public static Element[] getElements(Element parentElement, String nodeName)
//package com.java2s; //License from project: Open Source License import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; public class Main { public static Element[] getElements(Element parentElement, String nodeName) { NodeList list = parentElement.getElementsByTagName(nodeName); if (list == null) { return new Element[0]; }/* w w w . j av a 2 s. c o m*/ Element[] eles = new Element[list.getLength()]; for (int i = 0; i < list.getLength(); i++) { Node node = list.item(i); eles[i] = (Element) node; } return eles; } }