Java tutorial
//package com.java2s; // License as published by the Free Software Foundation; either import org.w3c.dom.Element; import org.w3c.dom.Node; public class Main { /** * Get the indexed Element. * <p> * Similar to <code>Element.getChildNodes.item</code>, but ignores any Nodes (such as * indentation TextNodes). */ public static Element getFirstChildElement(Element parent) { Node node = parent.getFirstChild(); while (node != null && !(node instanceof Element)) { node = node.getNextSibling(); } return (Element) node; } }