code: private static void enc(char in, StringBuilder out) {
          if (in == '&') {
              out.append("&amp;");
          } else if (in == '<') {
              out.append("&lt;");
          } else if (in == '>') {
              out.append("&gt;");
          } else if (in == '\"') {
              out.append("&quot;");
          } else if (in == '\'') {
              out.append("&apos;");
          } else {
              out.append(in);
          }
      }
docs: Appends an XML-appropriate encoding of the given character to the given
  StringBuffer.
  
  @param in
  The character.
  @param out
  The StringBuffer to write to.