Here you can find the source of isWhitespaceNode(Node n)
public static boolean isWhitespaceNode(Node n)
//package com.java2s; //License from project: Apache License import org.w3c.dom.Node; public class Main { public static boolean isWhitespaceNode(Node n) { if (n.getNodeType() == Node.TEXT_NODE) { String val = n.getNodeValue(); return val.trim().length() == 0; } else {//w w w . ja va 2 s . c om return false; } } }