/* * call-seq: * native_parse_io(data, encoding) * * Parse the document accessable via +io+ */ static VALUE native_parse_io(VALUE self, VALUE io, VALUE encoding) { xmlSAXHandlerPtr handler; Data_Get_Struct(self, xmlSAXHandler, handler); xmlCharEncoding enc = (xmlCharEncoding)NUM2INT(encoding); xmlParserCtxtPtr sax_ctx = xmlCreateIOParserCtxt( handler, (void *)self, (xmlInputReadCallback)io_read_callback, (xmlInputCloseCallback)io_close_callback, (void *)io, enc ); xmlParseDocument(sax_ctx); xmlFreeParserCtxt(sax_ctx); return io; }