//--------------------------------------------------------------------------- int Policy::import_schema_from_memory(const char* buffer, int len, const std::string& save_name) { if (!buffer || !len) { error = "The schema does not exist"; return -1; } Schema s(no_https); xmlSetGenericErrorFunc(&s, &s.manage_generic_error); xmlDocPtr doc = xmlParseMemory(buffer, len); if (!doc) { // maybe put the errors from s.errors error = "The schema given cannot be parsed"; xmlSetGenericErrorFunc(NULL, NULL); return -1; } int ret = import_schema_from_doc(doc, save_name); xmlFreeDoc(doc); xmlSetGenericErrorFunc(NULL, NULL); return ret; }
xmlDoc *XMLDocument::readDocument(const std::string & xmlCode, const char * encoding, bool validate, std::string * error) { xmlParserCtxt *ctxt = initContext(error, validate); xmlDoc *doc = 0; int options = XML_PARSE_NSCLEAN | XML_PARSE_NOBLANKS; if (validate) { options |= XML_PARSE_DTDVALID; } if (!ctxt) { xmlSetGenericErrorFunc(0, errorFunctionWithoutOutput); return 0; } doc = xmlCtxtReadDoc(ctxt, (const xmlChar *)xmlCode.c_str(), 0, encoding, options); if (!doc || !ctxt->valid) { *error = errorBuffer; } xmlSetGenericErrorFunc(0, errorFunctionWithoutOutput); xmlFreeParserCtxt(ctxt); return doc; }
int get_filter_from_xml(const char *xml, struct acl_filter **filter) { xmlDoc *xmldoc = NULL; int ret = 0; if (xml == NULL || filter == NULL) return 0; xmlSetGenericErrorFunc(NULL, swallow_err_msg); xmldoc = xmlParseMemory(xml, strlen(xml) + 1); if (xmldoc == NULL) goto err; *filter = calloc(1, sizeof(**filter)); if (*filter == NULL) goto err; ret = parse_acl_filter(xmldoc->children, *filter); if (ret == 0) { free(*filter); *filter = NULL; } err: xmlSetGenericErrorFunc(NULL, NULL); xmlFreeDoc(xmldoc); return ret; }
void Skeleton::LoadSkeletonDataFromXml(const char* xmlData, size_t xmlLength, std::string& xmlErrors) { xmlDoc* doc = NULL; try { xmlSetGenericErrorFunc(&xmlErrors, &errorHandler); doc = xmlParseMemory(xmlData, (int)xmlLength); if (doc) { xmlNode* root = xmlDocGetRootElement(doc); LoadSkeletonData(root); xmlFreeDoc(doc); doc = NULL; } xmlSetGenericErrorFunc(NULL, NULL); } catch (const ColladaException&) { if (doc) xmlFreeDoc(doc); xmlSetGenericErrorFunc(NULL, NULL); throw; } if (! xmlErrors.empty()) throw ColladaException("XML parsing failed"); }
ParseXML::ParseXML(void* session, startElementNsSAX2Func start) : startElementNs(start) , endElementNs(NULL) , characters(NULL) { XmlError MyError; MyError.Len = 0; xmlSetGenericErrorFunc(&MyError, ErrorCallback); xmlSAXHandler sax; memset(&sax, 0, sizeof(sax)); sax.initialized = XML_SAX2_MAGIC; sax.startElementNs = _start; sax.endElementNs = _end; sax.characters = _char; mXmlContext = xmlCreatePushParserCtxt(&sax, this, NULL, 0, NULL); if(mXmlContext == NULL) { xmlSetGenericErrorFunc(NULL, NULL); throw std::runtime_error(MyError.Len != 0 ? MyError.Value : "XML Error"); } curl_easy_setopt(session, CURLOPT_WRITEFUNCTION, ParseHandler); curl_easy_setopt(session, CURLOPT_WRITEDATA, this); }
/* str_unref() returned string */ static char *scrape_uri_from_lyricwiki_search_result(const char *buf, int64_t len) { xmlDocPtr doc; gchar *uri = NULL; /* * workaround buggy lyricwiki search output where it cuts the lyrics * halfway through the UTF-8 symbol resulting in invalid XML. */ GRegex *reg; reg = g_regex_new("<(lyrics?)>.*</\\1>", (G_REGEX_MULTILINE | G_REGEX_DOTALL | G_REGEX_UNGREEDY), 0, NULL); gchar *newbuf = g_regex_replace_literal(reg, buf, len, 0, "", G_REGEX_MATCH_NEWLINE_ANY, NULL); g_regex_unref(reg); /* * temporarily set our error-handling functor to our suppression function, * but we have to set it back because other components of Audacious depend * on libxml and we don't want to step on their code paths. * * unfortunately, libxml is anti-social and provides us with no way to get * the previous error functor, so we just have to set it back to default after * parsing and hope for the best. */ xmlSetGenericErrorFunc(NULL, libxml_error_handler); doc = xmlParseMemory(newbuf, strlen(newbuf)); xmlSetGenericErrorFunc(NULL, NULL); if (doc != NULL) { xmlNodePtr root, cur; root = xmlDocGetRootElement(doc); for (cur = root->xmlChildrenNode; cur; cur = cur->next) { if (xmlStrEqual(cur->name, (xmlChar *) "url")) { xmlChar *lyric; gchar *basename; lyric = xmlNodeGetContent(cur); basename = g_path_get_basename((gchar *) lyric); uri = str_printf("http://lyrics.wikia.com/index.php?action=edit" "&title=%s", basename); g_free(basename); xmlFree(lyric); } } xmlFreeDoc(doc); } g_free(newbuf); return uri; }
static xmlDocPtr docLoaderFunc(const xmlChar* uri, xmlDictPtr, int options, void* ctxt, xsltLoadType type) { if (!globalProcessor) return 0; switch (type) { case XSLT_LOAD_DOCUMENT: { xsltTransformContextPtr context = (xsltTransformContextPtr)ctxt; xmlChar* base = xmlNodeGetBase(context->document->doc, context->node); URL url(URL(ParsedURLString, reinterpret_cast<const char*>(base)), reinterpret_cast<const char*>(uri)); xmlFree(base); ResourceError error; ResourceResponse response; Vector<char> data; bool requestAllowed = globalCachedResourceLoader->frame() && globalCachedResourceLoader->document()->securityOrigin()->canRequest(url); if (requestAllowed) { globalCachedResourceLoader->frame()->loader().loadResourceSynchronously(url, AllowStoredCredentials, DoNotAskClientForCrossOriginCredentials, error, response, data); if (error.isNull()) requestAllowed = globalCachedResourceLoader->document()->securityOrigin()->canRequest(response.url()); else data.clear(); } if (!requestAllowed) { data.clear(); globalCachedResourceLoader->printAccessDeniedMessage(url); } PageConsole* console = 0; Frame* frame = globalProcessor->xslStylesheet()->ownerDocument()->frame(); if (frame && frame->page()) console = &frame->page()->console(); xmlSetStructuredErrorFunc(console, XSLTProcessor::parseErrorFunc); xmlSetGenericErrorFunc(console, XSLTProcessor::genericErrorFunc); // We don't specify an encoding here. Neither Gecko nor WinIE respects // the encoding specified in the HTTP headers. xmlDocPtr doc = xmlReadMemory(data.data(), data.size(), (const char*)uri, 0, options); xmlSetStructuredErrorFunc(0, 0); xmlSetGenericErrorFunc(0, 0); return doc; } case XSLT_LOAD_STYLESHEET: return globalProcessor->xslStylesheet()->locateStylesheetSubResource(((xsltStylesheetPtr)ctxt)->doc, uri); default: break; } return 0; }
/* * call-seq: * transform(document, params = []) * * Apply an XSLT stylesheet to an XML::Document. * +params+ is an array of strings used as XSLT parameters. * returns Nokogiri::XML::Document * * Example: * * doc = Nokogiri::XML(File.read(ARGV[0])) * xslt = Nokogiri::XSLT(File.read(ARGV[1])) * puts xslt.transform(doc, ['key', 'value']) * */ static VALUE transform(int argc, VALUE* argv, VALUE self) { VALUE xmldoc, paramobj, errstr, exception ; xmlDocPtr xml ; xmlDocPtr result ; nokogiriXsltStylesheetTuple *wrapper; const char** params ; long param_len, j ; int parse_error_occurred ; rb_scan_args(argc, argv, "11", &xmldoc, ¶mobj); if (NIL_P(paramobj)) { paramobj = rb_ary_new2(0L) ; } if (!rb_obj_is_kind_of(xmldoc, cNokogiriXmlDocument)) rb_raise(rb_eArgError, "argument must be a Nokogiri::XML::Document"); /* handle hashes as arguments. */ if(T_HASH == TYPE(paramobj)) { paramobj = rb_funcall(paramobj, rb_intern("to_a"), 0); paramobj = rb_funcall(paramobj, rb_intern("flatten"), 0); } Check_Type(paramobj, T_ARRAY); Data_Get_Struct(xmldoc, xmlDoc, xml); Data_Get_Struct(self, nokogiriXsltStylesheetTuple, wrapper); param_len = RARRAY_LEN(paramobj); params = calloc((size_t)param_len+1, sizeof(char*)); for (j = 0 ; j < param_len ; j++) { VALUE entry = rb_ary_entry(paramobj, j); const char * ptr = StringValuePtr(entry); params[j] = ptr; } params[param_len] = 0 ; errstr = rb_str_new(0, 0); xsltSetGenericErrorFunc((void *)errstr, xslt_generic_error_handler); xmlSetGenericErrorFunc(NULL, (xmlGenericErrorFunc)&swallow_superfluous_xml_errors); result = xsltApplyStylesheet(wrapper->ss, xml, params); free(params); xsltSetGenericErrorFunc(NULL, NULL); xmlSetGenericErrorFunc(NULL, NULL); parse_error_occurred = (Qfalse == rb_funcall(errstr, rb_intern("empty?"), 0)); if (parse_error_occurred) { exception = rb_exc_new3(rb_eRuntimeError, errstr); rb_exc_raise(exception); } return Nokogiri_wrap_xml_document((VALUE)0, result) ; }
bool XSLStyleSheet::parseString(const String& string, bool) { // Parse in a single chunk into an xmlDocPtr const UChar BOM = 0xFEFF; const unsigned char BOMHighByte = *reinterpret_cast<const unsigned char*>(&BOM); setLoaderForLibXMLCallbacks(docLoader()); if (!m_stylesheetDocTaken) xmlFreeDoc(m_stylesheetDoc); m_stylesheetDocTaken = false; #if ENABLE(INSPECTOR) Console* console = 0; if (Frame* frame = ownerDocument()->frame()) console = frame->domWindow()->console(); xmlSetStructuredErrorFunc(console, XSLTProcessor::parseErrorFunc); xmlSetGenericErrorFunc(console, XSLTProcessor::genericErrorFunc); #endif const char* buffer = reinterpret_cast<const char*>(string.characters()); int size = string.length() * sizeof(UChar); xmlParserCtxtPtr ctxt = xmlCreateMemoryParserCtxt(buffer, size); if (m_parentStyleSheet) { // The XSL transform may leave the newly-transformed document // with references to the symbol dictionaries of the style sheet // and any of its children. XML document disposal can corrupt memory // if a document uses more than one symbol dictionary, so we // ensure that all child stylesheets use the same dictionaries as their // parents. xmlDictFree(ctxt->dict); ctxt->dict = m_parentStyleSheet->m_stylesheetDoc->dict; xmlDictReference(ctxt->dict); } m_stylesheetDoc = xmlCtxtReadMemory(ctxt, buffer, size, href().utf8().data(), BOMHighByte == 0xFF ? "UTF-16LE" : "UTF-16BE", XML_PARSE_NOENT | XML_PARSE_DTDATTR | XML_PARSE_NOWARNING | XML_PARSE_NOCDATA); xmlFreeParserCtxt(ctxt); loadChildSheets(); xmlSetStructuredErrorFunc(0, 0); xmlSetGenericErrorFunc(0, 0); setLoaderForLibXMLCallbacks(0); return m_stylesheetDoc; }
static xmlDocPtr docLoaderFunc(const xmlChar* uri, xmlDictPtr, int options, void* ctxt, xsltLoadType type) { if (!globalProcessor) return 0; switch (type) { case XSLT_LOAD_DOCUMENT: { xsltTransformContextPtr context = (xsltTransformContextPtr)ctxt; xmlChar* base = xmlNodeGetBase(context->document->doc, context->node); KURL url(KURL(ParsedURLString, reinterpret_cast<const char*>(base)), reinterpret_cast<const char*>(uri)); xmlFree(base); ResourceLoaderOptions fetchOptions(ResourceFetcher::defaultResourceOptions()); FetchRequest request(ResourceRequest(url), FetchInitiatorTypeNames::xml, fetchOptions); request.setOriginRestriction(FetchRequest::RestrictToSameOrigin); ResourcePtr<Resource> resource = globalResourceFetcher->fetchSynchronously(request); if (!resource || !globalProcessor) return 0; PageConsole* console = 0; Frame* frame = globalProcessor->xslStylesheet()->ownerDocument()->frame(); if (frame && frame->page()) console = &frame->page()->console(); xmlSetStructuredErrorFunc(console, XSLTProcessor::parseErrorFunc); xmlSetGenericErrorFunc(console, XSLTProcessor::genericErrorFunc); // We don't specify an encoding here. Neither Gecko nor WinIE respects // the encoding specified in the HTTP headers. SharedBuffer* data = resource->resourceBuffer(); xmlDocPtr doc = data ? xmlReadMemory(data->data(), data->size(), (const char*)uri, 0, options) : 0; xmlSetStructuredErrorFunc(0, 0); xmlSetGenericErrorFunc(0, 0); return doc; } case XSLT_LOAD_STYLESHEET: return globalProcessor->xslStylesheet()->locateStylesheetSubResource(((xsltStylesheetPtr)ctxt)->doc, uri); default: break; } return 0; }
int init(void) { daemonize = TRUE; every = EVERY_5SECS; xmlSetGenericErrorFunc(NULL, UpwatchXmlGenericErrorFunc); return(1); }
int lpc2xml_convert_string(lpc2xml_context* context, char **content) { int ret = -1; xmlBufferPtr buffer = xmlBufferCreate(); xmlSaveCtxtPtr save_ctx; lpc2xml_context_clear_logs(context); xmlSetGenericErrorFunc(context, lpc2xml_genericxml_error); save_ctx = xmlSaveToBuffer(buffer, "UTF-8", XML_SAVE_FORMAT); if(save_ctx != NULL) { ret = internal_convert_lpc2xml(context); if(ret == 0) { ret = xmlSaveDoc(save_ctx, context->doc); if(ret != 0) { lpc2xml_log(context, LPC2XML_ERROR, "Can't save document"); lpc2xml_log(context, LPC2XML_ERROR, "%s", context->errorBuffer); } } xmlSaveClose(save_ctx); } else { lpc2xml_log(context, LPC2XML_ERROR, "Can't initialize internal buffer"); lpc2xml_log(context, LPC2XML_ERROR, "%s", context->errorBuffer); } if(ret == 0) { #if LIBXML_VERSION >= 20800 *content = (char *)xmlBufferDetach(buffer); #else *content = strdup((const char *)xmlBufferContent(buffer)); #endif } xmlBufferFree(buffer); return ret; }
XMLParser::XMLParser(Common::ReadStream &stream, bool makeLower, const Common::UString &fileName) { initXML(); Common::UString parseError; xmlSetGenericErrorFunc(static_cast<void *>(&parseError), errorFuncUString); const int options = XML_PARSE_NOWARNING | XML_PARSE_NOBLANKS | XML_PARSE_NONET | XML_PARSE_NSCLEAN | XML_PARSE_NOCDATA; xmlDocPtr xml = xmlReadIO(readStream, closeStream, static_cast<void *>(&stream), fileName.c_str(), 0, options); if (!xml) { Common::Exception e; if (!parseError.empty()) e.add("%s", parseError.c_str()); e.add("XML document failed to parse"); throw e; } BOOST_SCOPE_EXIT( (&xml) ) { xmlFreeDoc(xml); } BOOST_SCOPE_EXIT_END xmlNodePtr root = xmlDocGetRootElement(xml); if (!root) throw Common::Exception("XML document has no root node"); _rootNode.reset(new XMLNode(*root, makeLower)); deinitXML(); }
int irislwz_Validate(IRISLWZ_HANDLE *handle, const char *xml, char **beautified) /*!\brief Do an XML validation against a text * * This function takes the given \p xml test an tries to validate it with the XML * library (xmlReadMemory). If the XML is valid, a \p beautified version, which can * be better read by humans, can be stored optionally. * * \param[in] handle pointer to an IRISLWZ_HANDLE object * \param[in] xml pointer to the text which should be validated * \param[out] beautified optional pointer to which a beautified version of the xml * is written. The Memory for this is allocated by the library, but must be freed by the * client using \p free. * * \returns If the XML is valid, the function returns 1, otherwise 0. * * \example \code const char *xml="<iris1:request xmlns:iris1=\"urn:ietf:params:xml:ns:iris1\">" "<iris1:searchSet><iris1:lookupEntity registryType=\"dchk1\" " "entityClass=\"domain-name\" entityName=\"denic.de\"/>" "</iris1:searchSet></iris1:request>"; char *beautified=NULL; if (irislwz_Validate(handle,xml,&beautified)) { printf ("Original XML code:\n"); printf ("%s\n",xml); printf ("Beautified version:\n"); printf ("%s\n",beautified); } if (beautified) free(beautified); \endcode * * \ingroup DCHK_API_IRISLWZ */ { xmlSetGenericErrorFunc(handle,irislwz_xmlGenericErrorFunc); xmlDoc *doc = NULL; //xmlNode *root_element = NULL; int size=(int)strlen(xml); //printf ("Query: >>%s<<\n",xml); //printf ("Size: %i Bytes\n",size); doc = xmlReadMemory (xml, size, NULL, "UTF-8", XML_PARSE_NONET); if (doc == NULL) { irislwz_SetError(handle,74044,NULL); return 0; } if (beautified) { xmlChar *mem; int size; xmlKeepBlanksDefault(0); xmlDocDumpFormatMemoryEnc(doc, &mem, &size, handle->localcharset,1); *beautified=strdup((char*)mem); xmlFree(mem); } xmlFreeDoc(doc); return 1; }
// [[Rcpp::export]] void init_libxml2() { // Check that header and libs are compatible LIBXML_TEST_VERSION xmlInitParser(); xmlSetStructuredErrorFunc(NULL, handleStructuredError); xmlSetGenericErrorFunc(NULL, handleGenericError); }
int MOD_CLS_NAME::preload() { DBG("initializing libxml2...\n"); xmlInitParser(); initGenericErrorDefaultFunc(&handler); handler = (xmlGenericErrorFunc)xml_err_func; xmlSetGenericErrorFunc(NULL, &xml_err_func); return 0; }
void raptor_www_libxml_init(raptor_www *www) { www->error_handlers.handlers[RAPTOR_LOG_LEVEL_NONE].user_data=www; www->old_xmlGenericErrorContext=xmlGenericErrorContext; xmlSetGenericErrorFunc(&www->error_handlers, raptor_libxml_generic_error); www->ctxt=NULL; }
void initErrorHandler () { xmlSecErrorsSetCallback(secErrorCallback); xmlSetGenericErrorFunc(xml_error_str, xmlErrorCallback); #ifndef XMLSEC_NO_XSLT xsltSetGenericErrorFunc(xslt_error_str, xmlErrorCallback); #endif }
static void hwloc_libxml2_disable_stderrwarnings(void) { static int first = 1; if (first) { xmlSetGenericErrorFunc(NULL, hwloc__xml_verbose() ? xmlGenericError : hwloc_libxml2_error_callback); first = 0; } }
// Initialize libxml2 and check for potential ABI mismatches between // compiled version and the shared library actually used. void initXML() { console.log(CON_LOG, CON_ALWAYS, "Initializing libxml2..."); xmlInitParser(); LIBXML_TEST_VERSION; // Suppress libxml2 error messages xmlSetGenericErrorFunc(NULL, xmlNullLogger); }
void raptor_www_libxml_init(raptor_www *www) { initGenericErrorDefaultFunc(&www->old_handler); /* This will destroy the generic error default context: * there is no way to query and save it (xmlGenericErrorContext) */ xmlSetGenericErrorFunc(www, raptor_www_libxml_http_error); www->ctxt=NULL; }
void event_config_read (void) { int ret; ice_config_t *config; ice_config_t new_config, old_config; /* reread config file */ INFO0("Re-reading XML"); config = config_grab_config(); /* Both to get the lock, and to be able to find out the config filename */ xmlSetGenericErrorFunc (config->config_filename, log_parse_failure); xmlSetStructuredErrorFunc ("conf/file", config_xml_parse_failure); ret = config_parse_file(config->config_filename, &new_config); if(ret < 0) { ERROR0("Error parsing config, not replacing existing config"); switch(ret) { case CONFIG_EINSANE: ERROR0("Config filename null or blank"); break; case CONFIG_ENOROOT: ERROR1("Root element not found in %s", config->config_filename); break; case CONFIG_EBADROOT: ERROR1("Not an icecast2 config file: %s", config->config_filename); break; default: ERROR1("Parse error in reading %s", config->config_filename); break; } config_release_config(); } else { restart_logging (&new_config); config_set_config (&new_config, &old_config); config_release_config(); connection_thread_shutdown(); redirector_clearall(); fserve_scan ((time_t)0); config = config_get_config(); yp_recheck_config (config); fserve_recheck_mime_types (config); stats_global (config); workers_adjust (config->workers_count); connection_listen_sockets_close (config, 0); redirector_setup (config); update_relays (config); config_release_config(); slave_restart(); config_clear (&old_config); } }
int init(void) { if (!HAVE_OPT(OUTPUT)) { LOG(LOG_ERR, "missing output option"); return 0; } daemonize = TRUE; every = EVERY_MINUTE; xmlSetGenericErrorFunc(NULL, UpwatchXmlGenericErrorFunc); return(1); }
//--------------------------------------------------------------------------- int Policy::import_schema(const std::string& filename, const std::string& save_name) { Schema s(no_https); xmlSetGenericErrorFunc(&s, &s.manage_generic_error); xmlDocPtr doc = xmlParseFile(filename.c_str()); if (!doc) { // maybe put the errors from s.errors error = "The schema cannot be parsed"; xmlSetGenericErrorFunc(NULL, NULL); return -1; } int ret = import_schema_from_doc(doc, save_name); xmlFreeDoc(doc); xmlCleanupCharEncodingHandlers(); xmlSetGenericErrorFunc(NULL, NULL); return ret; }
XMLParser::XMLParser() : m_SchemaParserCtxt(0), m_Schema(0), m_SchemaValidCtxt(0), m_DTD(0), m_DTDValidCtxt(0), m_Doc(0) { xmlPedanticParserDefault(1); xmlSetGenericErrorFunc(this, errorOutputFunc); xmlDoValidityCheckingDefaultValue = 0; }
XMLDocumentParserScope::XMLDocumentParserScope(Document* document, xmlGenericErrorFunc genericErrorFunc, xmlStructuredErrorFunc structuredErrorFunc, void* errorContext) : m_oldDocument(currentDocument) , m_oldGenericErrorFunc(xmlGenericError) , m_oldStructuredErrorFunc(xmlStructuredError) , m_oldErrorContext(xmlGenericErrorContext) { currentDocument = document; if (genericErrorFunc) xmlSetGenericErrorFunc(errorContext, genericErrorFunc); if (structuredErrorFunc) xmlSetStructuredErrorFunc(errorContext, structuredErrorFunc); }
//--------------------------------------------------------------------------- int XsltPolicy::create_policy_from_mi(const std::string& report) { Xslt s(no_https); xmlSetGenericErrorFunc(&s, &s.manage_generic_error); xmlDocPtr doc = xmlParseMemory(report.c_str(), report.length()); xmlSetGenericErrorFunc(NULL, NULL); if (!doc) { // maybe put the errors from s.errors error = "The MediaInfo report given cannot be parsed"; return -1; } xmlNodePtr root = xmlDocGetRootElement(doc); if (!root) { error = "No root node, leaving"; xmlFreeDoc(doc); return 0; } for (xmlNodePtr child = root->children; child; child = child->next) { std::string def("media"); if (child->type == XML_TEXT_NODE || !child->name || def.compare((const char*)child->name)) continue; if (find_media_track_node(child) < 0) { xmlFreeDoc(doc); return -1; } break; } xmlFreeDoc(doc); return 0; }
int init(void) { if (!HAVE_OPT(OUTPUT)) { LOG(LOG_ERR, "missing output option"); return 0; } daemonize = TRUE; every = EVERY_MINUTE; startsec = OPT_VALUE_BEGIN; g_thread_init(NULL); xmlSetGenericErrorFunc(NULL, UpwatchXmlGenericErrorFunc); return(1); }
void wi_error_enter_thread(void) { wi_error_t *error; error = _wi_error_init(_wi_error_alloc()); wi_mutable_dictionary_set_data_for_key(wi_thread_dictionary(), error, WI_STR(_WI_ERROR_THREAD_KEY)); wi_release(error); wi_error_set_error(WI_ERROR_DOMAIN_NONE, WI_ERROR_NONE); #ifdef WI_LIBXML2 xmlSetGenericErrorFunc(NULL, _wi_error_xml_error_handler); #endif }
void raptor_libxml_finish(raptor_world* world) { if(world->libxml_flags & RAPTOR_WORLD_FLAG_LIBXML_STRUCTURED_ERROR_SAVE) xmlSetStructuredErrorFunc(world->libxml_saved_structured_error_context, world->libxml_saved_structured_error_handler); if(world->libxml_flags & RAPTOR_WORLD_FLAG_LIBXML_GENERIC_ERROR_SAVE) xmlSetGenericErrorFunc(world->libxml_saved_generic_error_context, world->libxml_saved_generic_error_handler); xmlCleanupParser(); }