Here you can find the source of hasChildElements(Node node)
public static boolean hasChildElements(Node node)
//package com.java2s; //License from project: Apache License import org.w3c.dom.Node; import org.w3c.dom.NodeList; public class Main { /** True if the node has child elements. */ public static boolean hasChildElements(Node node) { NodeList nlist = node.getChildNodes(); for (int i = 0; i < nlist.getLength(); i++) { Node child = nlist.item(i); if (child.getNodeType() == Node.ELEMENT_NODE) return true; }/*from ww w.j a v a 2 s. c o m*/ return false; } }