Here you can find the source of getFirstElementChild(final Node node)
public static Element getFirstElementChild(final Node node)
//package com.java2s; //License from project: Apache License import org.w3c.dom.Element; import org.w3c.dom.Node; public class Main { public static Element getFirstElementChild(final Node node) { Element elem = null;/* ww w . j av a2 s .c o m*/ for (Node childNode = node.getFirstChild(); childNode != null; childNode = childNode.getNextSibling()) { if (childNode.getNodeType() == Node.ELEMENT_NODE) { elem = (Element) childNode; return elem; } } return elem; } }