    /*
     * call-seq:
     *  parse_io(io, encoding)
     *
     * Parse +io+ object with +encoding+
     */
    static VALUE parse_io(VALUE klass, VALUE io, VALUE encoding)
    {
      xmlCharEncoding enc = (xmlCharEncoding)NUM2INT(encoding);

      xmlParserCtxtPtr ctxt = xmlCreateIOParserCtxt(
          NULL,
          NULL,
          (xmlInputReadCallback)io_read_callback,
          (xmlInputCloseCallback)io_close_callback,
          (void *)io,
          enc
      );

      return Data_Wrap_Struct(klass, NULL, deallocate, ctxt);
    }