docs: private void appendEscapedString(String s, StringBuilder builder) {
          if (s == null)
              s = "";
          int pos;
          int start = 0;
          int len = s.length();
          for (pos = 0; pos < len; pos++) {
              char ch = s.charAt(pos);
              String escape;
              switch (ch) {
              case '\t':
                  escape = "&#9;";
                  break;
              case '\n':
                  escape = "&#10;";
                  break;
              case '\r':
                  escape = "&#13;";
                  break;
              case '&':
                  escape = "&amp;";
                  break;
              case '"':
                  escape = "&quot;";
                  break;
              case '<':
                  escape = "&lt;";
                  break;
              case '>':
                  escape = "&gt;";
                  break;
              default:
                  escape = null;
                  break;
              }
  
              // If we found an escape character, write all the characters up to that
              // character, then write the escaped char and get back to scanning
              if (escape != null) {
                  if (start < pos)
                      builder.append(s, start, pos);
                  sb.append(escape);
                  start = pos + 1;
              }
          }
  
          // Write anything that's left
          if (start < pos) sb.append(s, start, pos);
      }