Java tutorial
//package com.java2s; import org.w3c.dom.Element; import org.w3c.dom.NodeList; public class Main { public static Element fetchSubElement(Element e, String subElementName) { if (e == null || subElementName == null) { return null; } subElementName = subElementName.toUpperCase(); NodeList list = e.getChildNodes(); for (int i = 0; i < list.getLength(); i++) { if (list.item(i) instanceof Element) { Element element = (Element) list.item(i); if (element.getTagName().toUpperCase().equals(subElementName)) { return element; } } } return null; } }