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.Node; import org.w3c.dom.NodeList; public class Main { /**// w ww . j a v a 2 s . c o m * returns the element with the given name */ public static Element getElement(Element config, String elementName) { NodeList children = config.getChildNodes(); Node node; for (int counter = 0; counter < children.getLength(); counter++) { node = children.item(counter); if (node instanceof Element) { if (((Element) node).getTagName().equals(elementName)) { return ((Element) node); } } } return null; } }