Here you can find the source of hasNonWhitespaceChildren(Element element)
public static boolean hasNonWhitespaceChildren(Element element)
//package com.java2s; /*/*from w w w .jav a 2 s . co m*/ * Copyright (c) 2012. betterFORM Project - http://www.betterform.de * Licensed under the terms of BSD License */ import org.w3c.dom.*; public class Main { /** * check, if the passed element node has non-whitespace children. * * @return true, if any Element nodes are found, otherwise false */ public static boolean hasNonWhitespaceChildren(Element element) { if (element.hasChildNodes()) { NodeList children = element.getChildNodes(); int len = children.getLength(); Node n = null; for (int i = 0; i < len; i++) { n = children.item(i); if (n.getNodeType() == Node.ELEMENT_NODE) { return true; } } return false; } else { return false; } } }