Java tutorial
//package com.java2s; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; public class Main { private final static boolean hasChilds(final Element element) { final NodeList list = element.getChildNodes(); final int length = list.getLength(); for (int i = 0; i < length; i++) { final Node node = list.item(i); if (node instanceof Element) { return true; } } return false; } }