private static boolean isAllWhitespace(Object obj) {
    String str;
    if (obj instanceof String) {
      str = (String)obj;
    }
    else if (obj instanceof Text) {
      str = ((Text)obj).getText();
    }
    else if (obj instanceof EntityRef) {
      return false;
    }
    else {
      return false;
    }

    for (int i = 0; i < str.length(); i++) {
      if (!Verifier.isXMLWhitespace(str.charAt(i))) {
        return false;
      }
    }
    return true;
  }
private static boolean isAllWhitespace(Object obj)