Here you can find the source of isEmptyElement(Node node)
public static boolean isEmptyElement(Node node)
//package com.java2s; //License from project: Apache License import org.jsoup.helper.StringUtil; import org.jsoup.nodes.*; public class Main { public static boolean isEmptyElement(Node node) { if (node == null) { return false; }//from ww w .java2 s. com if (node instanceof TextNode) { return StringUtil.isBlank(((TextNode) node).text()); } if (!(node instanceof Element)) { return false; } boolean isEmptyTag = ((Element) node).tag().isEmpty(); return !isEmptyTag && hasEmptyChidren(node); } public static boolean hasEmptyChidren(Node node) { if (node.childNodeSize() == 0) return true; for (Node n : node.childNodes()) { if (!(n instanceof TextNode)) { return false; } if (!StringUtil.isBlank(((TextNode) n).text())) { return false; } } return true; } }