docs: private static String escapeAttributeValue(String value) {
          final String escapees = ",=+<>#;\"\\";
          char[] chars = value.toCharArray();
          StringBuffer buf = new StringBuffer(2 * value.length());
  
          // Find leading and trailing whitespace.
          int lead; // index of first char that is not leading whitespace
          for (lead = 0; lead < chars.length; lead++) {
              if (!isWhitespace(chars[lead])) {
                  break;
              }
          }
          int trail; // index of last char that is not trailing whitespace
          for (trail = chars.length - 1; trail >= 0; trail--) {
              if (!isWhitespace(chars[trail])) {
                  break;
              }
          }
  
          for (int i = 0; i < chars.length; i++) {
              char c = chars[i];
              if ((i < lead) || (i > trail) || (escapees.indexOf(c) >= 0)) {
                  buf.append('\\');
              }
              buf.append(c);
          }
          return new String(buf);
      }