code: private StringBuilder appendAttributeValue(final String value, final StringBuilder buf) {
        if(value.contains("\"")) {
           buf.append("\'").append(escapeAttribute(value)).append("\'");
        } else if(value.contains(" ") || value.contains("\'") || value.contains("=")) {
           buf.append("\"").append(escapeAttribute(value)).append("\"");
        } else {
           buf.append(escapeAttribute(value));
        }
        return buf;
     }
docs: Appends an attribute value with appropriate quoting.
  @param value The value.
  @param buf The buffer to append to.
  @return The input buffer.