native_write (Nokogiri::XML::SAX::PushParser)

    /*
     * call-seq:
     *  native_write(chunk, last_chunk)
     *
     * Write +chunk+ to PushParser. +last_chunk+ triggers the end_document handle
     */
    static VALUE native_write(VALUE self, VALUE _chunk, VALUE _last_chunk)
    {
      xmlParserCtxtPtr ctx;
      Data_Get_Struct(self, xmlParserCtxt, ctx);

      const char * chunk  = NULL;
      int last_chunk      = 0;
      int size            = 0;

      if(Qnil != _chunk) {
        chunk = StringValuePtr(_chunk);
        size = RSTRING_LEN(_chunk);
      }
      if(Qtrue == _last_chunk) last_chunk = 1;

      if(xmlParseChunk(ctx, chunk, size, last_chunk))
        rb_raise(rb_eRuntimeError, "Couldn't parse chunk");

      return self;
    }