/*
   * encode document as string with specific encoding
   * (non-indented representation)
   *
   * encoding defaults to 'utf-8'
   *
   * alias: to_s
   *
   * call-seq:
   *  doc.encode -> String
   *  doc.encode("UTF-16") -> String
   *  doc.to_s -> string
   *
   */
  char *encode(const char *encoding = "utf-8") {