Here you can find the source of hasChildElements(Element element)
Parameter | Description |
---|---|
element | the namespace to analyze. |
public static boolean hasChildElements(Element element)
//package com.java2s; /*//from w w w . j av a 2 s .c om * 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; } }