Java XML Node Value Check isWhitespaceNode(Node n)

Here you can find the source of isWhitespaceNode(Node n)

Description

is Whitespace Node

License

Apache License

Declaration

public static boolean isWhitespaceNode(Node n) 

Method Source Code

//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;
        }
    }
}

Related

  1. isText(Node node)
  2. isText(Node node)
  3. isValidNode(Node node, String name)
  4. isWhiteSpace(Node node)
  5. isWhitespace(Node node)
  6. isWhitespaceNode(Node t)