Here you can find the source of hasAnyChildElement(final Element e)
public static boolean hasAnyChildElement(final Element e)
//package com.java2s; //License from project: Open Source License import org.w3c.dom.Element; import org.w3c.dom.Node; public class Main { public static boolean hasAnyChildElement(final Element e) { for (Node child = e.getFirstChild(); child != null; child = child .getNextSibling()) {/*from ww w .ja v a 2 s . c om*/ if (child instanceof Element) { return true; } } return false; } }