Java tutorial
//package com.java2s; /* * Jitsi, the OpenSource Java VoIP and Instant Messaging client. * * Distributable under LGPL license. * See terms of license at gnu.org. */ import org.w3c.dom.*; public class Main { /** * Indicates whether element has any child element. * * @param element the namespace to analyze. * @return true if element has any child element otherwise false. */ public static boolean hasChildElements(Element element) { NodeList childNodes = element.getChildNodes(); for (int i = 0; i < childNodes.getLength(); i++) { Node node = childNodes.item(i); if (node.getNodeType() == Node.ELEMENT_NODE) { return true; } } return false; } }