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; /*// ww w.ja v a2 s . c o m * 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; } }