/* * call-seq: * validate(document) * * Validate +document+ returning a list of errors */ static VALUE validate(VALUE self, VALUE document) { xmlDocPtr doc; xmlDtdPtr dtd; Data_Get_Struct(self, xmlDtd, dtd); Data_Get_Struct(document, xmlDoc, doc); VALUE error_list = rb_ary_new(); xmlValidCtxtPtr ctxt = xmlNewValidCtxt(); xmlSetStructuredErrorFunc((void *)error_list, Nokogiri_error_array_pusher); xmlValidateDtd(ctxt, doc, dtd); xmlSetStructuredErrorFunc(NULL, NULL); xmlFreeValidCtxt(ctxt); return error_list; }