Java tutorial
//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 readFirstChild(Node parentNode, String nodeName) { if (parentNode != null) { NodeList children = parentNode.getChildNodes(); for (int i = 0; i < children.getLength(); i++) { if (children.item(i).getNodeName().equals(nodeName)) return (Element) children.item(i); } } return null; } }