Java tutorial
//package com.java2s; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; public class Main { public static Element getChild(Element element, String fieldName) { if ((element == null) || (fieldName == null) || fieldName.equals("")) { return null; } NodeList children = element.getChildNodes(); for (int i = 0; i < children.getLength(); i++) { Node child = children.item(i); if ((child instanceof Element) && child.getNodeName().equals(fieldName)) { return (Element) child; } } return null; } }