Here you can find the source of getElement(Node parent, int index)
public static Element getElement(Node parent, int index)
//package com.java2s; //License from project: Apache License import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; public class Main { public static Element getElement(Node parent, int index) { int j = 0; NodeList nodes = parent.getChildNodes(); for (int i = 0; i < nodes.getLength(); i++) { Node node = nodes.item(i); if (node instanceof Element) { if (j == index) { return (Element) node; }/*from w ww. ja v a 2 s.c o m*/ j++; } } return null; } }