Here you can find the source of getElement(Element config, String elementName)
public static Element getElement(Element config, String elementName)
//package com.java2s; //License from project: Open Source License import org.w3c.dom.Element; import org.w3c.dom.NodeList; public class Main { /**//from ww w .jav a 2 s .c o m * returns the first element with the given name, null if none exists. */ public static Element getElement(Element config, String elementName) { NodeList children = config.getChildNodes(); for (int counter = 0; counter < children.getLength(); counter++) { if (children.item(counter) instanceof Element) { Element el = (Element) children.item(counter); if (el.getTagName().equals(elementName)) { return el; } } } return null; } }