您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ xmlCleanupParser函数代码示例

51自学网 2021-06-03 10:22:28
  C++
这篇教程C++ xmlCleanupParser函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中xmlCleanupParser函数的典型用法代码示例。如果您正苦于以下问题:C++ xmlCleanupParser函数的具体用法?C++ xmlCleanupParser怎么用?C++ xmlCleanupParser使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了xmlCleanupParser函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: cleanupReferenceData

//! /cond internalvoid cleanupReferenceData(){    xmlCleanupParser();}
开发者ID:rmcgibbo,项目名称:gromacs,代码行数:5,


示例2: main

//.........这里部分代码省略.........    if (argc <= 1) {	usage(argv[0]);	return(1);    }    for (i = 1; i < argc ; i++) {	if (!strcmp(argv[i], "-"))	    break;	if (argv[i][0] != '-')	    continue;	if ((!strcmp(argv[i], "-debug")) || (!strcmp(argv[i], "--debug"))) {	    debug++;	} else if ((!strcmp(argv[i], "-repeat")) ||	         (!strcmp(argv[i], "--repeat"))) {	    repeat++;#ifdef LIBXML_EXPR_ENABLED	} else if ((!strcmp(argv[i], "-expr")) ||	         (!strcmp(argv[i], "--expr"))) {	    use_exp++;#endif	} else if ((!strcmp(argv[i], "-i")) || (!strcmp(argv[i], "-f")) ||		   (!strcmp(argv[i], "--input")))	    filename = argv[++i];        else {	    fprintf(stderr, "Unknown option %s/n", argv[i]);	    usage(argv[0]);	}    }#ifdef LIBXML_EXPR_ENABLED    if (use_exp)	ctxt = xmlExpNewCtxt(0, NULL);#endif    if (filename != NULL) {#ifdef LIBXML_EXPR_ENABLED        if (use_exp)	    runFileTest(ctxt, filename);	else#endif	    testRegexpFile(filename);    } else {#ifdef LIBXML_EXPR_ENABLED        if (use_exp) {	    for (i = 1; i < argc ; i++) {		if ((argv[i][0] != '-') || (strcmp(argv[i], "-") == 0)) {		    if (pattern == NULL) {			pattern = argv[i];			printf("Testing expr %s:/n", pattern);			expr = xmlExpParse(ctxt, pattern);			if (expr == NULL) {			    printf("   failed to compile/n");			    break;			}			if (debug) {			    exprDebug(ctxt, expr);			}		    } else {			testReduce(ctxt, expr, argv[i]);		    }		}	    }	    if (expr != NULL)		xmlExpFree(ctxt, expr);	} else#endif        {	    for (i = 1; i < argc ; i++) {		if ((argv[i][0] != '-') || (strcmp(argv[i], "-") == 0)) {		    if (pattern == NULL) {			pattern = argv[i];			printf("Testing %s:/n", pattern);			comp = xmlRegexpCompile((const xmlChar *) pattern);			if (comp == NULL) {			    printf("   failed to compile/n");			    break;			}			if (debug)			    xmlRegexpPrint(stdout, comp);		    } else {			testRegexp(comp, argv[i]);		    }		}	    }	    if (comp != NULL)		xmlRegFreeRegexp(comp);        }    }#ifdef LIBXML_EXPR_ENABLED    if (ctxt != NULL) {	printf("Ops: %d nodes, %d cons/n",	       xmlExpCtxtNbNodes(ctxt), xmlExpCtxtNbCons(ctxt));	xmlExpFreeCtxt(ctxt);    }#endif    xmlCleanupParser();    xmlMemoryDump();    return(0);}
开发者ID:ArielleBassanelli,项目名称:gempak,代码行数:101,


示例3: getXmlDoc

void getXmlDoc(int sockfd, int read_status, int read_config) {    if(DEBUG>1) printf("[ getXmlDoc ]: from socket %d (read_status %d read_config %d)/n",sockfd,read_status,read_config);    // check that I'm not already polling it    if(xml_poll_status==1) {        if(DEBUG>1) printf("[ getXmlDoc ]: already polling so don't continue for this process (%d,%p)/n",xml_poll_status,xml_string);            return;    }    // occupy the poll flag    xml_poll_status = 1;    //clear old documents    if(DEBUG>2) printf("[ getXmlDoc ]: free xml string %p/n",xml_string);    free_xml_string();    //if(xml_string!=NULL) {    //  free(xml_string);    //}    if(DEBUG>2) printf("[ getXmlDoc ]: free xml string done %p/n",xml_string);    if(doc!=NULL) {              if(doc_prev!=NULL) {          if(DEBUG>2) printf("[ getXmlDoc ]: free the prev xml doc/n");          xmlFreeDoc(doc_prev);          doc_prev=NULL;       }       if(DEBUG>2) printf("[ getXmlDoc ]: copy to prev xml doc/n");       doc_prev = xmlCopyDoc(doc,1);              if(DEBUG>2) printf("[ getXmlDoc ]: free current xml doc/n");              xmlFreeDoc(doc);       xmlCleanupParser();       doc=NULL;       xml_root=NULL;    }    if(DEBUG>2) printf("[ getXmlDoc ]: free xml doc done/n");    // check that the socket is open    if(sockfd<=0) {        if(DEBUG>2) printf("[ getXmlDoc ]: socket is not open./n");        //clear the flag        xml_poll_status = 0;        return;    }    // Do a status and config read to be sure to catch all info    // Need to see exactly how the falgs are set in the return string     // from the server to see what to do here.    if(read_status>0) {        if(DEBUG>2) printf("[ getXmlDoc ]: ReadStatus/n");        writeReadStatus(sockfd);    }    if(read_config>0) {        if(DEBUG>2) printf("[ getXmlDoc ]: ReadConfig/n");        writeReadConfig(sockfd);    }    if(DEBUG>2) printf("[ getXmlDoc ]: Before reading xml string (%p)/n",xml_string);    pollXmlString(sockfd);    if(DEBUG>2) printf("[ getXmlDoc ]: After reading xml string (%p)/n",xml_string);    if(xml_string!=NULL) {        if(strlen(xml_string)>0) {           if(DEBUG>1) printf("[ getXmlDoc ]: create xml document from xml string(strlen %d)/n",strlen(xml_string));            if(DEBUG>1) printf("[ getXmlDoc ]: xml string:/n%s/n",xml_string);            doc = xmlReadMemory(xml_string,strlen(xml_string),"noname.xml",NULL,0);            if(DEBUG>1) printf("[ getXmlDoc ]: xml doc done %p/n",doc);            if(doc!=NULL) {                xml_root = xmlDocGetRootElement(doc);                if(xml_root!=NULL) {                   if(DEBUG>2) {                      printf("[ getXmlDoc ]: found xml_root name %s/n",(xml_root)->name);                      printf("[ getXmlDoc ]: print xml to file/n");                   }                   int bytes_written = xmlSaveFormatFile("svtdaq.xml",doc,1);                   if(DEBUG>2) {                      printf("[ getXmlDoc ]: printed %d bytes of xml to file/n",bytes_written);                   }                }            } else {                printf("[ getXmlDoc ]: [ ERROR ]: problem building xml doc at %p from /n%s/n",doc,xml_string);                exit(1);            }        } else {            printf("[ getXmlDoc ]: [ ERROR ]: xml_string is there but has zero string length!/n");	            exit(1);        }    } else {//.........这里部分代码省略.........
开发者ID:nerses73,项目名称:epics,代码行数:101,


示例4: test

//.........这里部分代码省略.........	    printf("%s fails to validate/n", filename);	}        else        {	    printf("%s validation generated an internal error/n",		   filename);	}	xmlSchemaFreeValidCtxt(schemaCtxt);        printf("/n<---- Document validated!/n");    }    /* Generate a doc and validate it. */    {	xmlDocPtr newDoc = xmlNewDoc(BAD_CAST "1.0");	{	    xmlSchemaValidCtxtPtr schemaCtxt;	    int ret;	    schemaCtxt = xmlSchemaNewValidCtxt(wxschemas);	    xmlSchemaSetValidErrors(schemaCtxt,				    (xmlSchemaValidityErrorFunc) fprintf,				    (xmlSchemaValidityWarningFunc) fprintf,				    stdout);	    xmlSchemaSetGeneratorCallback(schemaCtxt, BAD_CAST "people", NULL, &generation_callback, newDoc);	    ret = xmlSchemaValidateDoc(schemaCtxt, newDoc);	    if (ret == 0) {/* 		xmlDocSetRootElement(newDoc, vctxt->node); */		dump_doc(newDoc, NULL);	    } else if (ret > 0)		printf("%s fails to validate/n", filename);	    else		printf("%s validation generated an internal error/n",		       filename);	    xmlSchemaFreeValidCtxt(schemaCtxt);	    printf("/n<---- Schema read!/n/n");	}	{	    xmlSchemaValidCtxtPtr schemaCtxt;	    int ret;	    schemaCtxt = xmlSchemaNewValidCtxt(wxschemas);	    xmlSchemaSetValidErrors(schemaCtxt,				    (xmlSchemaValidityErrorFunc) fprintf,				    (xmlSchemaValidityWarningFunc) fprintf,				    stdout);	    ret = xmlSchemaValidateDoc(schemaCtxt, newDoc);	    if (ret == 0)		;	    else if (ret > 0)		printf("%s fails to validate/n", filename);	    else		printf("%s validation generated an internal error/n",		       filename);	    xmlSchemaFreeValidCtxt(schemaCtxt);	    printf("/n<---- Schema read!/n/n");	}	xmlFreeDoc(newDoc);    }#if 0    /* why can't I just start with doc->children? */    tree_trunk = xmlDocGetRootElement(docPtr);#endif#if 0    tree_trunk = docPtr->children;    printf("/n/n/n----------------------------------------------------------------/n/n/n");    printf("/nWalking doc tree.../n");    walk_doc_tree(tree_trunk, 0);    printf("/n");#endif    printf("/n/n/n----------------------------------------------------------------/n/n/n");    printf("/nWalking schema tree.../n");    walk_schema_tree(wxschemas);    printf("/n");    /*****************************************************************/    /*****************************************************************/    /*****************************************************************/    /*****************************************************************/    /* This will tell me, for example, how to decode sequences. */    printf("/n/n/n----------------------------------------------------------------/n/n/n");    xmlSchemaDump(stdout, wxschemas);    /*****************************************************************/    /*****************************************************************/    /*****************************************************************/    /*****************************************************************/    xmlFreeDoc(docPtr);    xmlCleanupParser();    xmlHashFree(Handle2Path, NULL);    return 0;}
开发者ID:ericprud,项目名称:libxml-annot,代码行数:101,


示例5: xmiStream

void DocbookGeneratorJob::run(){    UMLApp* app = UMLApp::app();    UMLDoc* umlDoc = app->document();    //write the XMI model in an in-memory char* string    QString xmi;    QTextStream xmiStream(&xmi, QIODevice::WriteOnly);#if QT_VERSION >= 0x050000    QTemporaryFile file; // we need this tmp file if we are writing to a remote file#else    KTemporaryFile file; // we need this tmp file if we are writing to a remote file#endif    file.setAutoRemove(false);    // lets open the file for writing    if (!file.open()) {        uError() << "There was a problem saving file" << file.fileName();        return;    }    umlDoc->saveToXMI(file); // save the xmi stuff to it    xsltStylesheetPtr cur = NULL;    xmlDocPtr doc, res;    const char *params[16 + 1];    int nbparams = 0;    params[nbparams] = NULL;#if QT_VERSION >= 0x050000    QString xsltFile(QStandardPaths::locate(QStandardPaths::DataLocation, QLatin1String("xmi2docbook.xsl")));#else    QString xsltFile(KGlobal::dirs()->findResource("appdata", QLatin1String("xmi2docbook.xsl")));#endif    xmlSubstituteEntitiesDefault(1);    xmlLoadExtDtdDefaultValue = 1;    cur = xsltParseStylesheetFile((const xmlChar *)xsltFile.toLatin1().constData());    doc = xmlParseFile((const char*)(file.fileName().toUtf8()));    res = xsltApplyStylesheet(cur, doc, params);#if QT_VERSION >= 0x050000    QTemporaryFile tmpDocBook;#else    KTemporaryFile tmpDocBook;#endif    tmpDocBook.setAutoRemove(false);    tmpDocBook.open();    umlDoc->writeToStatusBar(i18n("Exporting to DocBook..."));    xsltSaveResultToFd(tmpDocBook.handle(), res, cur);    xsltFreeStylesheet(cur);    xmlFreeDoc(res);    xmlFreeDoc(doc);    xsltCleanupGlobals();    xmlCleanupParser();    emit docbookGenerated(tmpDocBook.fileName());}
开发者ID:Nephos,项目名称:umbrello,代码行数:62,


示例6: analyticsEnabled

AppConfig::AppConfig(std::string& xmlfile) :	analyticsEnabled(true),	updateMonitorEnabled(true){	systemProperties = new PropertiesBinding();	xmlParserCtxtPtr context = xmlNewParserCtxt();	xmlDocPtr document = xmlCtxtReadFile(context, xmlfile.c_str(), NULL, 0);	if (!document)	{		std::ostringstream error;		if (context->lastError.code != XML_IO_LOAD_ERROR)		{			error << context->lastError.file << "[Line ";			error << context->lastError.line << "] ";		}		error << context->lastError.message;		GetLogger()->Error(error.str());		xmlFreeParserCtxt(context);		xmlCleanupParser();		return;	}	xmlNodePtr root = xmlDocGetRootElement(document);	xmlNodePtr node = root->children;	while (node)	{		if (node->type != XML_ELEMENT_NODE)		{			node = node->next;			continue;		}		// This should always be a UTF-8, so we can just cast		// the node name here to a char*		std::string nodeName(reinterpret_cast<char*>(			const_cast<xmlChar*>(node->name)));		if (nodeName == "name")		{			appName = ConfigUtils::GetNodeValue(node);		}		else if (nodeName == "id")		{			appID = ConfigUtils::GetNodeValue(node);		}		else if (nodeName == "description")		{			description = ConfigUtils::GetNodeValue(node);		}		else if (nodeName == "copyright")		{			copyright = ConfigUtils::GetNodeValue(node);		}		else if (nodeName == "url")		{			url = ConfigUtils::GetNodeValue(node);		}		else if (nodeName == "version")		{			version = ConfigUtils::GetNodeValue(node);		}		else if (nodeName == "publisher")		{			publisher = ConfigUtils::GetNodeValue(node);		}		else if (nodeName == "window")		{			this->windows.push_back(WindowConfig::FromXMLNode(node));		}		else if (nodeName == "analytics")		{			std::string nodeValue(ConfigUtils::GetNodeValue(node));			analyticsEnabled = ConfigUtils::StringToBool(nodeValue);		}		else if (nodeName == "update-monitor")		{			std::string nodeValue(ConfigUtils::GetNodeValue(node));			updateMonitorEnabled = ConfigUtils::StringToBool(nodeValue);		}		else if (nodeName == "icon")		{			icon = ConfigUtils::GetNodeValue(node);		}		else if (nodeName == "property")		{			ParsePropertyNode(node, systemProperties->GetConfig());		}		node = node->next;	}	xmlFreeDoc(document);	xmlFreeParserCtxt(context);	xmlCleanupParser();}
开发者ID:Adimpression,项目名称:TideSDK,代码行数:97,


示例7: engine_start

//.........这里部分代码省略.........    xmlInitGlobals();    xmlInitParser();    xmlInitThreads();    engine = engine_create();    if (!engine) {        ods_fatal_exit("[%s] create failed", engine_str);        return;    }    engine->daemonize = daemonize;    /* config */    engine->config = engine_config(engine->allocator, cfgfile,        cmdline_verbosity);    status = engine_config_check(engine->config);    if (status != ODS_STATUS_OK) {        ods_log_error("[%s] cfgfile %s has errors", engine_str, cfgfile);        goto earlyexit;    }    if (info) {        engine_config_print(stdout, engine->config); /* for debugging */        goto earlyexit;    }    /* check pidfile */    if (!util_check_pidfile(engine->config->pid_filename)) {        exit(1);    }    /* open log */    ods_log_init(engine->config->log_filename, engine->config->use_syslog,       engine->config->verbosity);    /* setup */    tzset(); /* for portability */    status = engine_setup(engine);    if (status != ODS_STATUS_OK) {        ods_log_error("[%s] setup failed: %s", engine_str,            ods_status2str(status));        engine->need_to_exit = 1;        if (status != ODS_STATUS_WRITE_PIDFILE_ERR) {            /* command handler had not yet been started */            engine->cmdhandler_done = 1;        }    } else {        /* setup ok, mark hsm open */        close_hsm = 1;    }    /* run */    while (engine->need_to_exit == 0) {        /* update zone list */        lock_basic_lock(&engine->zonelist->zl_lock);        zl_changed = zonelist_update(engine->zonelist,            engine->config->zonelist_filename);        engine->zonelist->just_removed = 0;        engine->zonelist->just_added = 0;        engine->zonelist->just_updated = 0;        lock_basic_unlock(&engine->zonelist->zl_lock);        /* start/reload */        if (engine->need_to_reload) {            ods_log_info("[%s] signer reloading", engine_str);            engine->need_to_reload = 0;        } else {            ods_log_info("[%s] signer started", engine_str);            zl_changed = engine_recover(engine);        }        if (zl_changed == ODS_STATUS_OK ||            zl_changed == ODS_STATUS_UNCHANGED) {            engine_update_zones(engine, zl_changed);        }        engine_run(engine, single_run);    }    /* shutdown */    ods_log_info("[%s] signer shutdown", engine_str);    if (close_hsm) {        ods_log_verbose("[%s] close hsm", engine_str);        hsm_close();    }    if (!engine->cmdhandler_done) {        engine_stop_xfrhandler(engine);        engine_stop_dnshandler(engine);        engine_stop_cmdhandler(engine);    }earlyexit:    if (engine && engine->config) {        if (engine->config->pid_filename) {            (void)unlink(engine->config->pid_filename);        }        if (engine->config->clisock_filename) {            (void)unlink(engine->config->clisock_filename);        }    }    tsig_handler_cleanup();    engine_cleanup(engine);    engine = NULL;    ods_log_close();    xmlCleanupParser();    xmlCleanupGlobals();    xmlCleanupThreads();    return;}
开发者ID:jschlyter,项目名称:opendnssec-workflow-test,代码行数:101,


示例8: xpath_table

//.........这里部分代码省略.........		/* Parse the document */		doctree = xmlParseMemory(xmldoc, strlen(xmldoc));		if (doctree == NULL)		{						/* not well-formed, so output all-NULL tuple */			ret_tuple = BuildTupleFromCStrings(attinmeta, values);			oldcontext = MemoryContextSwitchTo(per_query_ctx);			tuplestore_puttuple(tupstore, ret_tuple);			MemoryContextSwitchTo(oldcontext);			heap_freetuple(ret_tuple);		}		else		{			/* New loop here - we have to deal with nodeset results */			rownr = 0;			do			{				/* Now evaluate the set of xpaths. */				had_values = 0;				for (j = 0; j < numpaths; j++)				{					ctxt = xmlXPathNewContext(doctree);					ctxt->node = xmlDocGetRootElement(doctree);					xmlSetGenericErrorFunc(ctxt, pgxml_errorHandler);					/* compile the path */					comppath = xmlXPathCompile(xpaths[j]);					if (comppath == NULL)					{						xmlCleanupParser();						xmlFreeDoc(doctree);						elog_error(ERROR, "XPath Syntax Error", 1);						PG_RETURN_NULL();		/* Keep compiler happy */					}					/* Now evaluate the path expression. */					res = xmlXPathCompiledEval(comppath, ctxt);					xmlXPathFreeCompExpr(comppath);					if (res != NULL)					{						switch (res->type)						{							case XPATH_NODESET:								/* We see if this nodeset has enough nodes */								if ((res->nodesetval != NULL) && (rownr < res->nodesetval->nodeNr))								{									resstr =										xmlXPathCastNodeToString(res->nodesetval->nodeTab[rownr]);									had_values = 1;								}								else									resstr = NULL;								break;							case XPATH_STRING:								resstr = xmlStrdup(res->stringval);								break;
开发者ID:CraigBryan,项目名称:PostgresqlFun,代码行数:66,


示例9: cleanup

//!//! Cleanup the LIBXML library (Unused for now)//!static void cleanup(void){    xsltCleanupGlobals();    xmlCleanupParser();                // calls xmlCleanupGlobals()}
开发者ID:NalaGinrut,项目名称:eucalyptus,代码行数:8,


示例10: engine_setup

/** * Set up engine. * */static ods_statusengine_setup(engine_type* engine){    ods_status status = ODS_STATUS_OK;    struct sigaction action;    int result = 0;    int sockets[2] = {0,0};    ods_log_debug("[%s] setup signer engine", engine_str);    if (!engine || !engine->config) {        return ODS_STATUS_ASSERT_ERR;    }    /* set edns */    edns_init(&engine->edns, EDNS_MAX_MESSAGE_LEN);    /* create command handler (before chowning socket file) */    engine->cmdhandler = cmdhandler_create(engine->allocator,        engine->config->clisock_filename);    if (!engine->cmdhandler) {        return ODS_STATUS_CMDHANDLER_ERR;    }    engine->dnshandler = dnshandler_create(engine->allocator,        engine->config->interfaces);    engine->xfrhandler = xfrhandler_create(engine->allocator);    if (!engine->xfrhandler) {        return ODS_STATUS_XFRHANDLER_ERR;    }    if (engine->dnshandler) {        if (socketpair(AF_UNIX, SOCK_DGRAM, 0, sockets) == -1) {            return ODS_STATUS_XFRHANDLER_ERR;        }        engine->xfrhandler->dnshandler.fd = sockets[0];        engine->dnshandler->xfrhandler.fd = sockets[1];        status = dnshandler_listen(engine->dnshandler);        if (status != ODS_STATUS_OK) {            ods_log_error("[%s] setup: unable to listen to sockets (%s)",                engine_str, ods_status2str(status));        }    }    /* privdrop */    engine->uid = privuid(engine->config->username);    engine->gid = privgid(engine->config->group);    /* TODO: does piddir exists? */    /* remove the chown stuff: piddir? */    ods_chown(engine->config->pid_filename, engine->uid, engine->gid, 1);    ods_chown(engine->config->clisock_filename, engine->uid, engine->gid, 0);    ods_chown(engine->config->working_dir, engine->uid, engine->gid, 0);    if (engine->config->log_filename && !engine->config->use_syslog) {        ods_chown(engine->config->log_filename, engine->uid, engine->gid, 0);    }    if (engine->config->working_dir &&        chdir(engine->config->working_dir) != 0) {        ods_log_error("[%s] setup: unable to chdir to %s (%s)", engine_str,            engine->config->working_dir, strerror(errno));        return ODS_STATUS_CHDIR_ERR;    }    if (engine_privdrop(engine) != ODS_STATUS_OK) {        return ODS_STATUS_PRIVDROP_ERR;    }    /* daemonize */    if (engine->daemonize) {        switch ((engine->pid = fork())) {            case -1: /* error */                ods_log_error("[%s] setup: unable to fork daemon (%s)",                    engine_str, strerror(errno));                return ODS_STATUS_FORK_ERR;            case 0: /* child */                break;            default: /* parent */                engine_cleanup(engine);                engine = NULL;                xmlCleanupParser();                xmlCleanupGlobals();                xmlCleanupThreads();                exit(0);        }        if (setsid() == -1) {            ods_log_error("[%s] setup: unable to setsid daemon (%s)",                engine_str, strerror(errno));            return ODS_STATUS_SETSID_ERR;        }    }    engine->pid = getpid();    ods_log_verbose("[%s] running as pid %lu", engine_str,        (unsigned long) engine->pid);    /* catch signals */    signal_set_engine(engine);    action.sa_handler = signal_handler;    sigfillset(&action.sa_mask);    action.sa_flags = 0;    sigaction(SIGTERM, &action, NULL);    sigaction(SIGHUP, &action, NULL);    sigaction(SIGINT, &action, NULL);    sigaction(SIGILL, &action, NULL);    sigaction(SIGUSR1, &action, NULL);    sigaction(SIGALRM, &action, NULL);//.........这里部分代码省略.........
开发者ID:jschlyter,项目名称:opendnssec-workflow-test,代码行数:101,


示例11: syslog

bool CPhotoSpriteLoader::DownloadPhotos(void) {	if (!_HTTP->Get("http://fotki.yandex.ru/export/slideshow-best50.xml", _XMLFileName)) {		syslog(LOG_ERR, "Cannot load slideshow-best50.xml");		return false;	};	xmlDoc * XMLDoc = NULL;	xmlNode * Elem = NULL;	LIBXML_TEST_VERSION	XMLDoc = xmlReadFile(_XMLFileName, NULL, 0);	if (XMLDoc == NULL)		return false;	Elem = xmlDocGetRootElement(XMLDoc);	Elem = Elem->children;	do {		if (strcmp((char*)Elem->name, "image") == 0) {			 xmlAttr * Attr = Elem->properties;			 while (Attr && strcmp((char*)Attr->name, "url") != 0)				 Attr = Attr->next;			 if (Attr) {				 char * XMLURL = (char*)Attr->children->content;				 size_t szXMLURL = strlen(XMLURL);				 char * URL = new char[szXMLURL + 2];				 strcpy(URL, XMLURL);				 URL[szXMLURL - 1] = 0;				 strcat(URL, "XL");				 char * FileName = strrchr(URL, '/');				 char * FullFileName = new char[strlen(_DownloadFolder) + strlen(FileName) + 1];				 strcpy(FullFileName, _DownloadFolder);				 strcat(FullFileName, FileName);				 for (int i=0; i<3; i++)					 if (_HTTP->Get(URL, FullFileName))						 break;				 delete[] URL;				 delete[] FullFileName;			 };		};		Elem = Elem->next;	} while (Elem);	xmlFreeDoc(XMLDoc);	xmlCleanupParser();	remove(_XMLFileName);	//Удаляем старые файлы	DIR * dir = opendir(_PhotoFolder);	struct dirent * dent;	struct stat buf;	size_t szPhotoFolder = strlen(_PhotoFolder);	if (dir != NULL) {		while ((dent = readdir(dir)) != NULL) {			size_t szFileName = szPhotoFolder + strlen(dent->d_name) + 2;			char * FileName = new char[szFileName];			sprintf(FileName, "%s/%s", _PhotoFolder, dent->d_name);			stat(FileName, &buf);			if (S_ISREG(buf.st_mode))				remove(FileName);			delete[] FileName;		};		closedir(dir);	};	//Перемещаем скаченные файлы	dir = opendir(_DownloadFolder);	size_t szDownloadFolder = strlen(_DownloadFolder);	if (dir != NULL) {		while ((dent = readdir(dir)) != NULL) {			char * OldFileName = new char[szDownloadFolder + strlen(dent->d_name) + 2];			char * NewFileName = new char[szPhotoFolder + strlen(dent->d_name) + 2];			sprintf(OldFileName, "%s/%s", _DownloadFolder, dent->d_name);			sprintf(NewFileName, "%s/%s", _PhotoFolder, dent->d_name);			stat(OldFileName, &buf);			if (S_ISREG(buf.st_mode))				rename(OldFileName, NewFileName);			delete[] OldFileName;			delete[] NewFileName;		};		closedir(dir);	};	return true;}
开发者ID:sergei-svistunov,项目名称:YandexFotkiSaver,代码行数:92,


示例12: xmlCleanupParser

	~XmlParserCleaner()	{		xmlCleanupParser();	}
开发者ID:bjornjohansson,项目名称:ircbot,代码行数:4,


示例13: wxBeginBusyCursor

wxString frmReport::XslProcessReport(const wxString &xml, const wxString &xsl){	xmlChar *output = 0;	xmlDocPtr ssDoc = 0, xmlDoc = 0, resDoc = 0;	xsltStylesheetPtr ssPtr = 0;	int length;	wxBeginBusyCursor();	// Apply the stylesheet	xmlSubstituteEntitiesDefault (1); // Substitute entities	xmlLoadExtDtdDefaultValue = 1; // Load external entities	// Parse the stylesheet	ssDoc = xmlParseDoc(XML_FROM_WXSTRING(xsl));	if (!ssDoc)	{		wxEndBusyCursor();		wxLogError(_("Failed to parse the XML stylesheet!"));		goto cleanup;	}	ssPtr = xsltParseStylesheetDoc(ssDoc);	if (!ssPtr)	{		wxEndBusyCursor();		wxLogError(_("Failed to parse the XSL stylesheet!"));		goto cleanup;	}	// Parse the data	xmlDoc = xmlParseDoc(XML_FROM_WXSTRING(xml));	if (!xmlDoc)	{		wxEndBusyCursor();		wxLogError(_("Failed to parse the XML document!"));		goto cleanup;	}	// Apply the stylesheet	resDoc = xsltApplyStylesheet(ssPtr, xmlDoc, NULL);	if (!resDoc)	{		wxEndBusyCursor();		wxLogError(_("Failed to apply the XSL stylesheet to the XML document!"));		goto cleanup;	}	// Get the result	xsltSaveResultToString (&output, &length, resDoc, ssPtr);	if (!resDoc)	{		wxEndBusyCursor();		wxLogError(_("Failed to read the processed document!"));		goto cleanup;	}cleanup:	// Cleanup	if (resDoc)		xmlFreeDoc(resDoc);	if (xmlDoc)		xmlFreeDoc(xmlDoc);	if (ssPtr)		xsltFreeStylesheet(ssPtr);	// This crashes - dunno why :-(	// if (ssDoc)	//  xmlFreeDoc(ssDoc);	xsltCleanupGlobals();	xmlCleanupParser();	wxEndBusyCursor();	if (output)		return WXSTRING_FROM_XML(output);	else		return wxEmptyString;}
开发者ID:KrisShannon,项目名称:pgadmin3,代码行数:83,


示例14: xmlCleanupParser

void parser::global_cleanup() {	xmlCleanupParser();	curl_global_cleanup();}
开发者ID:kastian,项目名称:newsbeuter,代码行数:4,


示例15: PoleXmlSec_sign

static PyObject *PoleXmlSec_sign(PyObject *self, PyObject *args){    const char *xml, *key, *certificate, *id_attr_name, *id_node_name;    PyObject* result;    if (!PyArg_ParseTuple(args, "sssss", &xml, &key, &certificate, &id_attr_name, &id_node_name))        return NULL;    result = Py_BuildValue("s", xml);    /* Init libxml and libxslt libraries */    xmlInitParser();    LIBXML_TEST_VERSION    xmlLoadExtDtdDefaultValue = XML_DETECT_IDS | XML_COMPLETE_ATTRS;    xmlSubstituteEntitiesDefault(1);#ifndef XMLSEC_NO_XSLT    xmlIndentTreeOutput = 1;#endif /* XMLSEC_NO_XSLT */    /* Init xmlsec library */    if(xmlSecInit() < 0) {        fprintf(stderr, "XmlSecError: xmlsec initialization failed./n");        return result;    }    /* Check loaded library version */    if(xmlSecCheckVersion() != 1) {        fprintf(stderr, "XmlSecError: loaded xmlsec library version is not compatible./n");        return result;    }    /* Load default crypto engine if we are supporting dynamic     * loading for xmlsec-crypto libraries. Use the crypto library     * name ("openssl", "nss", etc.) to load corresponding     * xmlsec-crypto library.     */#ifdef XMLSEC_CRYPTO_DYNAMIC_LOADING    if(xmlSecCryptoDLLoadLibrary(BAD_CAST XMLSEC_CRYPTO) < 0) {        fprintf(stderr, "XmlSecError: unable to load default xmlsec-crypto library. Make sure/n"                        "that you have it installed and check shared libraries path/n"                        "(LD_LIBRARY_PATH) envornment variable./n");        return result;    }#endif /* XMLSEC_CRYPTO_DYNAMIC_LOADING */    /* Init crypto library */    if(xmlSecCryptoAppInit(NULL) < 0) {        fprintf(stderr, "XmlSecError: crypto initialization failed./n");        return result;    }    /* Init xmlsec-crypto library */    if(xmlSecCryptoInit() < 0) {        fprintf(stderr, "XmlSecError: xmlsec-crypto initialization failed./n");        return result;    }    result = sign_xml(xml, key, certificate, id_attr_name, id_node_name);    /* Shutdown xmlsec-crypto library */    xmlSecCryptoShutdown();    /* Shutdown xmlsec library */    xmlSecShutdown();    /* Shutdown crypto library */    /* Se executar essa linha dá erro na conex
C++ xmlCopyNode函数代码示例
C++ xmlBufferFree函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。