VALUE Nokogiri_wrap_xml_syntax_error(VALUE klass, xmlErrorPtr error) { if(!klass) klass = cNokogiriXmlSyntaxError; xmlErrorPtr ptr = calloc(1, sizeof(xmlError)); xmlCopyError(error, ptr); return Data_Wrap_Struct(klass, NULL, dealloc, ptr); }
void Nokogiri_error_handler(void * ctx, xmlErrorPtr error) { // FIXME: I'm interneting this. I *think* the pointer passed in here gets // freed on its own, thats why I copy it. // The files are *in* the computer. xmlErrorPtr ptr = calloc(1, sizeof(xmlError)); xmlCopyError(error, ptr); VALUE err = Data_Wrap_Struct(cNokogiriXmlSyntaxError, NULL, dealloc, ptr); VALUE block = rb_funcall(mNokogiri, rb_intern("error_handler"), 0); rb_funcall(block, rb_intern("call"), 1, err); }
static void libxml_error_handler(void* userData, xmlErrorPtr error) { if (tl_libxml_request_data->m_suppress_error) { return; } xmlErrorVec* error_list = &tl_libxml_request_data->m_errors; error_list->resize(error_list->size() + 1); xmlError &error_copy = error_list->back(); memset(&error_copy, 0, sizeof(xmlError)); if (error) { xmlCopyError(error, &error_copy); } else { error_copy.code = XML_ERR_INTERNAL_ERROR; error_copy.level = XML_ERR_ERROR; } }
LibxmlXmlException::LibxmlXmlException(const LibxmlXmlException& e) { ZeroStruct(m_xmlError); XmlCheck(xmlCopyError(const_cast<xmlError*>(&e.m_xmlError), &m_xmlError)); }
LibxmlXmlException::LibxmlXmlException(xmlError *err) : base(MAKE_HRESULT(SEVERITY_ERROR, FACILITY_LIBXML, err->code), err->message) { ZeroStruct(m_xmlError); XmlCheck(xmlCopyError(err, &m_xmlError)); }