Java tutorial
//package com.java2s; // are made available under the terms of the Eclipse Public License v1.0 import org.w3c.dom.Element; import org.w3c.dom.NodeList; public class Main { public static Element getFirstChild(Element tag, String childTagName) { NodeList nodes = tag.getElementsByTagName(childTagName); if (nodes == null || nodes.getLength() == 0) { return null; } return (Element) nodes.item(0); } }