Here you can find the source of getFirstChildElement(Element parent)
public static Element getFirstChildElement(Element parent)
//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 getFirstChildElement(Element elem, String name) { NodeList elems = elem.getElementsByTagName(name); return (Element) elems.item(0); }/*from ww w .j a v a 2s . c o m*/ public static Element getFirstChildElement(Element parent) { NodeList children = parent.getChildNodes(); if (children.getLength() == 0) return null; for (int k = 0; k < children.getLength(); k++) { Node kid = children.item(k); if (kid instanceof Element) { return (Element) kid; } } return null; } }