Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
// publish, distribute, sublicense, and/or sell copies of the Software, 

import org.w3c.dom.Node;

public class Main {
    /**
     * Returns true if the node has some actual content (other than a comment or an
     * empty text).
     * 
     * @param node the XML node
     * @return true if the node contains information, false otherwise
     */
    public static boolean hasContent(Node node) {
        if (node.getNodeName().equals("#comment")) {
            return false;
        } else if (node.getNodeName().equals("#text")) {
            return !node.getNodeValue().trim().isEmpty();
        }
        return true;
    }
}