/*
* call-seq:
* initialize_native(xml_sax, filename)
*
* Initialize the push parser with +xml_sax+ using +filename+
*/
static VALUE initialize_native(VALUE self, VALUE _xml_sax, VALUE _filename)
{
xmlSAXHandlerPtr sax;
Data_Get_Struct(_xml_sax, xmlSAXHandler, sax);
const char * filename = NULL;
if(_filename != Qnil) filename = StringValuePtr(_filename);
xmlParserCtxtPtr ctx = xmlCreatePushParserCtxt(
sax,
(void *)self,
NULL,
0,
filename
);
if(ctx == NULL)
rb_raise(rb_eRuntimeError, "Could not create a parser context");
ctx->sax2 = 1;
DATA_PTR(self) = ctx;
return self;
}