docs: private String unescape(String value) {
      if (value.indexOf('&') < 0) {
        return value;
      }
      StringBuilder sb = new StringBuilder();
      for (int i = 0; i < value.length(); i++) {
        char c = value.charAt(i);
        if (c == '&') {
          if (i + 2 < value.length() && value.charAt(i + 1) == '#') {
            if (value.charAt(i + 2) == 'x') {
              int x = i + 3;
              int charval = 0;
              while (x < value.length() && value.charAt(x) != ';') {
                int digit = "0123456789abcdef".indexOf(value.charAt(x));
                if (digit < 0) {
                  digit = "0123456789ABCDEF".indexOf(value.charAt(x));
                }
                if (digit < 0) {
                  return null;
                }
                charval = charval * 16 + digit;
                x++;
              }
              char hexchar = (char) charval;
              sb.append(hexchar);
              i = x;
            } else {
              int x = i + 2;
              int charval = 0;
              while (x < value.length() && value.charAt(x) != ';') {
                int digit = "0123456789".indexOf(value.charAt(x));
                if (digit < 0) {
                  return null;
                }
                charval = charval * 10 + digit;
                x++;
              }
              char decchar = (char) charval;
              sb.append(decchar);
              i = x;
            }
          } else if (value.substring(i + 1).startsWith("lt;")) {
            sb.append('<');
            i += 3;
          } else if (value.substring(i + 1).startsWith("gt;")) {
            sb.append('>');
            i += 3;
          } else if (value.substring(i + 1).startsWith("amp;")) {
            sb.append('&');
            i += 4;
          } else if (value.substring(i + 1).startsWith("quot;")) {
            sb.append('"');
            i += 5;
          } else if (value.substring(i + 1).startsWith("apos;")) {
            sb.append('\'');
            i += 5;
          } else {
            return null;
          }
  
        } else {
          sb.append(c);
        }
      }
      return sb.toString();
    }