Java tutorial
//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; for (Node childNode = node.getFirstChild(); childNode != null; childNode = childNode.getNextSibling()) { if (childNode.getNodeType() == Node.ELEMENT_NODE) { elem = (Element) childNode; return elem; } } return elem; } }