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

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

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

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

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

示例1: switch

char *xml_parser_node_query(WsXmlNodeH node, int what){	char *ptr = NULL;	xmlNodePtr xmlNode = (xmlNodePtr) node;	iWsNode *wsNode = (iWsNode *) xmlNode->_private;	switch (what) {	case XML_TEXT_VALUE:		if (wsNode == NULL)			xmlNode->_private = wsNode =				u_zalloc(sizeof(iWsNode));		if (wsNode != NULL) {			if (wsNode->valText == NULL) {				wsNode->valText =					(char *) xmlNodeGetContent(xmlNode);			}			ptr = wsNode->valText;		}		break;	case XML_LOCAL_NAME:		ptr = (char *) xmlNode->name;		break;	case XML_NS_URI:		if (xmlNode->ns != NULL)			ptr = (char *) xmlNode->ns->href;		break;	case XML_NS_PREFIX:		if (xmlNode->ns != NULL)			ptr = (char *) xmlNode->ns->prefix;		break;	default:		break;	}	return ptr;}
开发者ID:juergh,项目名称:dash-sdk,代码行数:37,


示例2: __lastfm_art_xml_get_artist_bio

static gchar* __lastfm_art_xml_get_artist_bio(const gchar* data , gint size){	xmlDocPtr doc = xmlParseMemory(data,size);	gchar* info=NULL;	if(doc)	{		xmlNodePtr root = xmlDocGetRootElement(doc);		/* Todo this is ugly */		xmlNodePtr bio = get_first_node_by_name(				get_first_node_by_name(get_first_node_by_name(root,						BAD_CAST"artist"),					BAD_CAST"bio"),				BAD_CAST"content");		if(bio)		{			xmlChar *temp = xmlNodeGetContent(bio);			info = g_strdup((gchar*) temp);			xmlFree(temp);		}	}	xmlFreeDoc(doc);	return info;}
开发者ID:emillon,项目名称:gmpc,代码行数:24,


示例3: test_log_severity_to_elem_works_with_int_min

void test_log_severity_to_elem_works_with_int_min(){	severity->level_val = INT_MIN;	xmlNodePtr new_elem = NULL;	enum jal_status ret = jalp_log_severity_to_elem(severity, new_doc, &new_elem);	assert_not_equals(NULL, new_elem);	assert_equals(JAL_OK, ret);	xmlDocSetRootElement(new_doc, new_elem);	xmlChar *ret_val = NULL;	assert_equals(1, new_doc != NULL);	assert_equals(0, xmlStrcmp(new_doc->xmlChildrenNode->name, BAD_CAST "Severity"));	ret_val = xmlGetProp(new_doc->xmlChildrenNode, BAD_CAST NAME_ATTR_NAME);	assert_equals(0, xmlStrcmp(ret_val, BAD_CAST LEVEL_NAME));	xmlFree(ret_val);	ret_val = xmlNodeGetContent(new_doc->xmlChildrenNode);	char *min = NULL;	int check = jal_asprintf(&min, "%d", INT_MIN);	assert_equals(1, check > 0);	assert_equals(0, xmlStrcmp(ret_val, BAD_CAST min));	xmlFree(ret_val);	assert_equals(0, validate(new_doc, __FUNCTION__, TEST_XML_APP_META_TYPES_SCHEMA, 0));}
开发者ID:jalop-tresys,项目名称:JALoP,代码行数:24,


示例4: as_validator_check_children_quick

/** * as_validator_check_children_quick: **/static voidas_validator_check_children_quick (AsValidator *validator, xmlNode *node, const gchar *allowed_tagname, AsComponent *cpt){	xmlNode *iter;	for (iter = node->children; iter != NULL; iter = iter->next) {		const gchar *node_name;		gchar *node_content;		/* discard spaces */		if (iter->type != XML_ELEMENT_NODE)			continue;		node_name = (const gchar*) iter->name;		node_content = (gchar*) xmlNodeGetContent (iter);		if (g_strcmp0 (node_name, allowed_tagname) == 0) {			gchar *tag_path;			tag_path = g_strdup_printf ("%s/%s", (const gchar*) node->name, node_name);			as_validator_check_content_empty (validator,								node_content,								tag_path,								AS_ISSUE_IMPORTANCE_WARNING,								cpt);			g_free (tag_path);		} else {			as_validator_add_issue (validator,						AS_ISSUE_IMPORTANCE_WARNING,						AS_ISSUE_KIND_TAG_UNKNOWN,						"Found tag '%s' in section '%s'. Only '%s' tags are allowed.",						node_name,						(const gchar*) node->name,						allowed_tagname);		}		g_free (node_content);	}}
开发者ID:neilmayhew,项目名称:appstream,代码行数:39,


示例5: get_eag_node

//get node under root has not attributes int get_eag_node(char * fpath,char * node_name,char *content){	xmlDocPtr pdoc = NULL;	xmlNodePtr pcurnode = NULL;	char *psfilename;	psfilename = fpath;	pdoc = xmlReadFile(psfilename,"utf-8",256); 	if(NULL == pdoc)	{		return 1;	}	pcurnode = xmlDocGetRootElement(pdoc);  	pcurnode = pcurnode->xmlChildrenNode; 	xmlChar *value;	while (NULL != pcurnode)	{					if (!xmlStrcmp(pcurnode->name, BAD_CAST node_name))           		{		    			value = xmlNodeGetContent(pcurnode);        				strcpy(content,(char *)value);			 			xmlFree(value);		}        		pcurnode = pcurnode->next; 	}	  	//xmlSaveFile(fpath,pdoc);  	xmlFreeDoc(pdoc);	return 0;}
开发者ID:inibir,项目名称:daemongroup,代码行数:37,


示例6: simpleXpathMakeTag

static void simpleXpathMakeTag (xmlNode *node,				const tagXpathMakeTagSpec *spec,				const kindOption* const kinds,				void *userData){	tagEntryInfo tag;	xmlChar* str;	const kindOption *kind;	str = xmlNodeGetContent(node);	if (str == NULL)		return;	kind = kinds + spec->kind;	if (spec->role == ROLE_INDEX_DEFINITION)		initTagEntry (&tag, (char *)str, kind);	else if (isXtagEnabled(XTAG_REFERENCE_TAGS))		initRefTagEntry (&tag, (char *)str,				 kind,				 spec->role);	else		goto out;	tag.lineNumber = xmlGetLineNo (node);	tag.filePosition = getInputFilePositionForLine (tag.lineNumber);	if (spec->make)		spec->make (node, spec, &tag, userData);	else		makeTagEntry (&tag);out:	xmlFree (str);}
开发者ID:pavelzak,项目名称:ctags,代码行数:36,


示例7: default_parse_item

static voiddefault_parse_item (ProponoConnection *conn, xmlNode *root){  xmlNode *curr;  xmlChar *s_value;  for (curr = root->children; curr; curr = curr->next)    {      s_value = xmlNodeGetContent (curr);      if (!xmlStrcmp(curr->name, (const xmlChar *)"host"))	propono_connection_set_host (conn, s_value);      else if (!xmlStrcmp(curr->name, (const xmlChar *)"name"))	propono_connection_set_name (conn, s_value);      else if (!xmlStrcmp(curr->name, (const xmlChar *)"username"))	propono_connection_set_username (conn, s_value);      else if (!xmlStrcmp(curr->name, (const xmlChar *)"port"))	propono_connection_set_port (conn, atoi (s_value));      else if (!xmlStrcmp(curr->name, (const xmlChar *)"fullscreen"))	propono_connection_set_fullscreen (conn, propono_utils_parse_boolean (s_value));      xmlFree (s_value);    }}
开发者ID:gfunkmonk2,项目名称:propono,代码行数:24,


示例8: xmlGetNoNsProp

//---------------------------------------------------------------------------void JsTree::interpret_trace_data_in_data(xmlNodePtr data, std::string& json){    //Format: "text": "name", "data": {"offset": "offset_hexa", "dataValue": "value (value_in_hexa)"}    std::string offset; //Decimal to hexa    std::string name;    std::string value; //decimal + hexa if numerical    xmlChar *offset_c = xmlGetNoNsProp(data, (const unsigned char*)"offset");    if (offset_c != NULL)        offset = (const char *)offset_c;    xmlChar *name_c = xmlGetNoNsProp(data, (const unsigned char*)"name");    if (name_c != NULL)        name = std::string((const char *)name_c);    xmlChar *value_c = xmlNodeGetContent(data);    if (value_c != NULL)        value = std::string((const char *)value_c);    json += ", /"text/":/"";    json += name;    //Block data    json += "/", /"data/":{";    bool coma = false;    if (offset_c)    {        interpret_offset(offset, coma, json);        coma = true;    }    if (value.length())    {        interpret_value(value, coma, json);        coma = true;    }    json += "}";}
开发者ID:ablwr,项目名称:MediaConch_SourceCode,代码行数:37,


示例9: xmlSecXPathDataNodeRead

static intxmlSecXPathDataNodeRead(xmlSecXPathDataPtr data, xmlNodePtr node) {    int ret;    xmlSecAssert2(data != NULL, -1);    xmlSecAssert2(data->expr == NULL, -1);    xmlSecAssert2(data->ctx != NULL, -1);    xmlSecAssert2(node != NULL, -1);    ret = xmlSecXPathDataRegisterNamespaces (data, node);    if(ret < 0) {        xmlSecInternalError("xmlSecXPathDataRegisterNamespaces", NULL);        return(-1);    }    /* read node content and set expr */    data->expr = xmlNodeGetContent(node);    if(data->expr == NULL) {        xmlSecInvalidNodeContentError(node, NULL, "empty");        return(-1);    }    return(0);}
开发者ID:esproul,项目名称:xmlsec,代码行数:24,


示例10: xmlSecOpenSSLHmacNodeRead

static intxmlSecOpenSSLHmacNodeRead(xmlSecTransformPtr transform, xmlNodePtr node, xmlSecTransformCtxPtr transformCtx) {    xmlSecOpenSSLHmacCtxPtr ctx;    xmlNodePtr cur;    xmlSecAssert2(xmlSecOpenSSLHmacCheckId(transform), -1);    xmlSecAssert2(xmlSecTransformCheckSize(transform, xmlSecOpenSSLHmacSize), -1);    xmlSecAssert2(node!= NULL, -1);    xmlSecAssert2(transformCtx != NULL, -1);    ctx = xmlSecOpenSSLHmacGetCtx(transform);    xmlSecAssert2(ctx != NULL, -1);    cur = xmlSecGetNextElementNode(node->children);     if((cur != NULL) && xmlSecCheckNodeName(cur, xmlSecNodeHMACOutputLength, xmlSecDSigNs)) {  	xmlChar *content;		content = xmlNodeGetContent(cur);	if(content != NULL) {	    ctx->dgstSize = atoi((char*)content);	    	    xmlFree(content);	}	/* todo: error if dgstSize == 0 ?*/	cur = xmlSecGetNextElementNode(cur->next);    }        if(cur != NULL) {	xmlSecErr_a_ignorar5(XMLSEC_ERRORS_HERE,		    xmlSecErrorsSafeString(xmlSecTransformGetName(transform)),		    xmlSecErrorsSafeString(xmlSecNodeGetName(cur)),		    XMLSEC_ERRORS_R_UNEXPECTED_NODE,		    XMLSEC_ERRORS_NO_MESSAGE);	return(-1);    }    return(0); }
开发者ID:Arcenciel,项目名称:DDReader,代码行数:36,


示例11: parse_compatibility

static void parse_compatibility(struct uae_prefs *p, xmlNode *node){  for(xmlNode *curr_node = node; curr_node; curr_node = curr_node->next) {    if (curr_node->type == XML_ELEMENT_NODE && strcmp((const char *)curr_node->name, _T("compatibility")) == 0) {      xmlChar *content = xmlNodeGetContent(curr_node);      if(content != NULL) {        if(strcmp((const char *) content, "flexible-blitter-immediate") == 0)          p->immediate_blits = 1;        else if(strcmp((const char *) content, "turbo-floppy") == 0)          p->floppy_speed = 400;        else if(strcmp((const char *) content, "flexible-sprite-collisions-spritesplayfield") == 0)          p->collision_level = 2;        else if(strcmp((const char *) content, "flexible-sprite-collisions-spritesonly") == 0)          p->collision_level = 1;        else if(strcmp((const char *) content, "flexible-sound") == 0)          p->produce_sound = 2;        else if(strcmp((const char *) content, "flexible-maxhorizontal-nohires") == 0)          clip_no_hires = true;        else if(strcmp((const char *) content, "jit") == 0)        {          p->cachesize = 8192;          p->address_space_24 = 0;        }        else if(strcmp((const char *) content, "flexible-cpu-cycles") == 0)          p->cpu_compatible = 0;        else if(strcmp((const char *) content, "flexible-maxhorizontal-nosuperhires") == 0)          ; /* nothing to change */        else if(strcmp((const char *) content, "flexible-maxvertical-nointerlace") == 0)          ; /* nothing to change */        else          printf("rp9: unknown compatibility: %s/n", content);        xmlFree(content);      }          }  }}
开发者ID:BrianSidebotham,项目名称:uae4arm-rpi,代码行数:36,


示例12: parse_ram

static void parse_ram(struct uae_prefs *p, xmlNode *node){  for(xmlNode *curr_node = node; curr_node; curr_node = curr_node->next) {    if (curr_node->type == XML_ELEMENT_NODE && strcmp((const char *)curr_node->name, _T("ram")) == 0) {      xmlChar *content = xmlNodeGetContent(curr_node);      if(content != NULL) {        xmlChar *attr = xmlGetProp(curr_node, (const xmlChar *) _T("type"));        if(attr != NULL)         {          int size = atoi((const char *)content);          if(strcmp((const char *) attr, "fast") == 0)            p->fastmem_size = size;          else if(strcmp((const char *) attr, "z3") == 0)            p->z3fastmem_size = size;          else if(strcmp((const char *) attr, "chip") == 0)            p->chipmem_size = size;          xmlFree(attr);        }        xmlFree(content);      }          }  }}
开发者ID:BrianSidebotham,项目名称:uae4arm-rpi,代码行数:24,


示例13: pa_addAttributeNode

/// @todo: проверить, обновляется ли parent!static void pa_addAttributeNode(xmlNode& selfNode, xmlAttr& attrNode) {	if(attrNode.type!=XML_ATTRIBUTE_NODE)		throw Exception(PARSER_RUNTIME,			0,			"must be ATTRIBUTE_NODE");    /*     * Add it at the end to preserve parsing order ...     */    if (selfNode.properties == NULL) {        selfNode.properties = &attrNode;    } else {        xmlAttrPtr prev = selfNode.properties;        while (prev->next != NULL)            prev = prev->next;        prev->next = &attrNode;        attrNode.prev = prev;    }    if (xmlIsID(selfNode.doc, &selfNode, &attrNode) == 1)        xmlAddID(NULL, selfNode.doc, xmlNodeGetContent((xmlNode*)&attrNode), &attrNode);}
开发者ID:viatsko,项目名称:parser3,代码行数:25,


示例14: while

void UiThemeSetting::loadUiSelfAdaptArea(const std::string &name,xmlNodePtr node,UiThemeDef *themeDef){    if(name.size() == 0){        return;    }    SelfAdaptBgData *bgData = new SelfAdaptBgData;    bgData->setName(name);    std::string key,value;    while(node){        if(strcmp((char*)node->name, "text") == 0){            //filter return char here            node = node->next;            continue;        }else{            key = (char*)node->name;            xmlChar *data = xmlNodeGetContent(node);            value = (char*)data;            xmlFree(data);            bgData->setAreaData(key,value);        }        node = node->next;    }    themeDef->addSelfAdaptBgData(bgData);}
开发者ID:firedragonpzy,项目名称:DirectFire-android,代码行数:24,


示例15: decode_buffer_response

/* * If there is a mismatch or an error, then gda_connection_add_event_string() is used * *  - Modifies @sbuffer (to separate HASH from XML part) *  - if all OK, extracs the <challenge> value and replace cdata->next_challenge with it (or simply *    reset cdata->next_challenge to NULL) * * Returns: a new #xmlDocPtr, or %NULL on error */static xmlDocPtrdecode_buffer_response (GdaConnection *cnc, WebConnectionData *cdata, SoupBuffer *sbuffer,			gchar *out_status_chr, guint *out_counter_id){	xmlDocPtr doc;	gchar *ptr, *response;	if (out_status_chr)		*out_status_chr = 0;	if (out_counter_id)		*out_counter_id = 0;	g_assert (sbuffer);	response = (gchar*) sbuffer->data;	for (ptr = response; *ptr && (*ptr != '/n'); ptr++);	if (*ptr != '/n') {		gda_connection_add_event_string (cnc, _("Could not parse server's reponse"));		return NULL;	}	*ptr = 0;	ptr++;	if ((cdata->key && !check_hash (cdata->key, ptr, response)) &&	    (cdata->server_secret && !check_hash (cdata->server_secret, ptr, response))) {		gda_connection_add_event_string (cnc, _("Invalid response hash"));		return NULL;	}	doc = xmlParseMemory (ptr, strlen (ptr));	if (!doc) {		gda_connection_add_event_string (cnc, _("Could not parse server's reponse"));		return NULL;	}	else {		xmlNodePtr node, root;		root = xmlDocGetRootElement (doc);		for (node = root->children; node; node = node->next) {			if (!strcmp ((gchar*) node->name, "session")) {				xmlChar *contents;				contents = xmlNodeGetContent (node);				g_free (cdata->session_id);				cdata->session_id = g_strdup ((gchar*) contents);				xmlFree (contents);			}			else if (!strcmp ((gchar*) node->name, "challenge")) {				xmlChar *contents;				if (cdata->next_challenge) {					g_free (cdata->next_challenge);					cdata->next_challenge = NULL;				}				contents = xmlNodeGetContent (node);				cdata->next_challenge = g_strdup ((gchar*) contents);				xmlFree (contents);			}			else if (out_status_chr && !strcmp ((gchar*) node->name, "status")) {				xmlChar *contents;				contents = xmlNodeGetContent (node);				*out_status_chr = *contents;				xmlFree (contents);			}			else if (out_counter_id && !strcmp ((gchar*) node->name, "counter")) {				xmlChar *contents;				contents = xmlNodeGetContent (node);				*out_counter_id = atoi ((gchar*) contents);				xmlFree (contents);			}			else if (!cdata->server_id && !strcmp ((gchar*) node->name, "servertype")) {				xmlChar *contents;				contents = xmlNodeGetContent (node);				cdata->server_id = g_strdup ((gchar*) contents);				xmlFree (contents);				cdata->reuseable = _gda_provider_reuseable_new (cdata->server_id);#ifdef DEBUG_WEB_PROV				g_print ("REUSEABLE [%s]: %p/n", cdata->server_id, cdata->reuseable);#endif			}			else if (!cdata->server_version && !strcmp ((gchar*) node->name, "serverversion")) {				xmlChar *contents;				contents = xmlNodeGetContent (node);				cdata->server_version = g_strdup ((gchar*) contents);				xmlFree (contents);#ifdef DEBUG_WEB_PROV				g_print ("SERVER version [%s]/n", cdata->server_version);#endif			}		}	}//.........这里部分代码省略.........
开发者ID:arthurnn,项目名称:libgda,代码行数:101,


示例16: command_gda_report_section_run

/* * COMMAND: <gda_report_section> * * creates a new RunContext, then executes its children, and destroys the RunContext * * uses node's contents: yes * requested attributes: "query_name" * * REM: either "query_name" or a <gda_report_query> sub node must be provided to create a data model. */static gbooleancommand_gda_report_section_run (GdaReportEngine *engine, xmlNodePtr node, GSList **created_nodes,				RunContext *context, GError **error){		xmlChar *qname;	RunContext *ctx = NULL;		/* compute stmt to push a RunContext */	qname = xmlGetProp (node, BAD_CAST "query_name");	if (qname) {		GdaStatement *stmt;		GdaConnection *cnc = NULL;		xmlChar *prop;		/* find statement */		stmt = run_context_find_stmt (engine, context, qname);		if (!stmt) {			g_set_error (error, 0, 0,				     _("Unknown query '%s'"), qname);			xmlFree (qname);			return FALSE;		}		/* find which connection to use */		prop = xmlGetProp (node, BAD_CAST "cnc_name");		cnc = run_context_find_connection (engine, context, prop);		if (!cnc) {			if (prop) {				g_set_error (error, 0, 0,					     _("No connection named '%s' found"), prop);				xmlFree (prop);			}			else				g_set_error (error, 0, 0, "%s", 					     _("No connection specified"));			return FALSE;		}		ctx = run_context_push_with_stmt (engine, context, cnc, stmt, (gchar *) qname, error);		xmlFree (qname);	}	else {		xmlNodePtr child;		for (child = node->children; child; child = child->next) {			if (!strcmp ((gchar *) child->name, "gda_report_query")) {				GdaStatement *stmt;				xmlChar *prop;				GdaConnection *cnc = NULL;				GdaSqlParser *parser = NULL;				/* find which connection to use */				prop = xmlGetProp (child, BAD_CAST "cnc_name");				cnc = run_context_find_connection (engine, context, prop);				if (!cnc) {					if (prop) {						g_set_error (error, 0, 0,							     _("No connection named '%s' found"), prop);						xmlFree (prop);					}					else						g_set_error (error, 0, 0, "%s", 							     _("No connection specified"));					return FALSE;				}								/* parser object */				parser = g_object_get_data (G_OBJECT (cnc), "__gda_parser");				if (!parser) {					parser = gda_connection_create_parser (cnc);					g_object_set_data_full (G_OBJECT (cnc), "__gda_parser", 								parser, g_object_unref);				}								/* statement */				stmt = gda_sql_parser_parse_string (parser, (gchar *) xmlNodeGetContent (child), 								    NULL, error);				if (!stmt)					return FALSE;				qname = xmlGetProp (child, BAD_CAST "query_name");				if (qname) {					ctx = run_context_push_with_stmt (engine, context, cnc,									  stmt, (gchar *) qname, error);					xmlFree (qname);				}				else					ctx = run_context_push_with_stmt (engine, context, cnc,									  stmt, "context", error);				if (ctx)					ctx->stmt = stmt;//.........这里部分代码省略.........
开发者ID:UIKit0,项目名称:libgda,代码行数:101,


示例17: get_attr_val

static inline xmlChar* get_attr_val(xmlAttrPtr attr){    return xmlNodeGetContent((xmlNodePtr)attr);}
开发者ID:GYGit,项目名称:reactos,代码行数:4,


示例18: r_notification_parse

//.........这里部分代码省略.........		for(nephew = child->children; nephew; nephew = nephew->next)				if (nephew->type == XML_ELEMENT_NODE)		{			rc = pkg_malloc(sizeof(r_regcontact));			if (!rc){				LOG(L_ERR,"ERR:"M_NAME":r_notification_parse: Error allocating %d bytes/n",					sizeof(r_regcontact));				goto error;			}			memset(rc,0,sizeof(r_regcontact));						x = xmlGetProp(nephew,(xmlChar*)"id");			space_trim_dup(&(rc->id),(char*)x);			xmlFree(x);							x = xmlGetProp(nephew,(xmlChar*)"state");			if (x[0]=='a'||x[0]=='A') 				rc->state = IMS_REGINFO_ACTIVE;			else 				rc->state = IMS_REGINFO_TERMINATED;			xmlFree(x);						x = xmlGetProp(nephew,(xmlChar*)"event");			switch(x[0]){				case 'r':case 'R':					switch (x[2]){						case 'g': case 'G':							rc->event = IMS_REGINFO_CONTACT_REGISTERED;							break;						case 'f': case 'F':							rc->event = IMS_REGINFO_CONTACT_REFRESHED;							break;												case 'j': case 'J':							rc->event = IMS_REGINFO_CONTACT_REJECTED;							break;												default:							rc->event = IMS_REGINFO_NONE;					}					break;				case 'c':case 'C':					rc->event = IMS_REGINFO_CONTACT_CREATED;						break;				case 's':case 'S':					rc->event = IMS_REGINFO_CONTACT_SHORTENED;						break;				case 'e':case 'E':					rc->event = IMS_REGINFO_CONTACT_EXPIRED;						break;				case 'd':case 'D':					rc->event = IMS_REGINFO_CONTACT_DEACTIVATED;						break;				case 'p':case 'P':					rc->event = IMS_REGINFO_CONTACT_PROBATION;						break;				case 'u':case 'U':					rc->event = IMS_REGINFO_CONTACT_UNREGISTERED;						break;				default:					rc->event = IMS_REGINFO_NONE;				}			xmlFree(x);			x = xmlGetProp(nephew,(xmlChar*)"expires");						if (x) {				rc->expires = atoi((char*)x);				xmlFree(x);			}						node = nephew->children;			while(node && node->type!=XML_ELEMENT_NODE)				node =node->next;			if (node) {				x = xmlNodeGetContent(node);				space_trim_dup(&(rc->uri),(char*)x);				xmlFree(x);			}						rc->next = r->contact;			r->contact = rc;		}				r->next = n->registration;		n->registration = r;						}				if (reginfo_state) xmlFree(reginfo_state);				if (doc) xmlFreeDoc(doc);	xml.s[xml.len]=c;	return n;error:		if (reginfo_state) xmlFree(reginfo_state);			if (doc) xmlFreeDoc(doc);	xml.s[xml.len]=c;	if (n) r_notification_free(n);	return 0;}
开发者ID:asyn,项目名称:openvims,代码行数:101,


示例19: dict_get_translate

GPtrArray * dict_get_translate(const gchar * keyword){	gchar * key_url = NULL;	htmlDocPtr html_doc = NULL;	xmlDocPtr doc = NULL;	xmlNodePtr clone = NULL;	xmlXPathContextPtr ctx = NULL;	xmlXPathObjectPtr obj = NULL;	xmlNodeSetPtr nodeset = NULL;	gchar * tmp_str = NULL;	GPtrArray * result = NULL;	gint i;	key_url = g_strjoin(NULL, KEY_URL_PREFIX, keyword, KEY_URL_SUFIX, NULL);	g_debug("KEY-URL: %s", key_url);	html_doc = htmlReadFile(key_url, NULL, HTML_PARSE_NOWARNING | HTML_PARSE_NOERROR);	if (!html_doc)	{		g_message("KEY-URL %s get failed", key_url);		goto out;	}	ctx = xmlXPathNewContext((xmlDocPtr)html_doc);	if (!ctx)	{		g_message("XPath context creat failed");		goto out;	}	obj = xmlXPathEvalExpression(KEY_WORD_XPATH, ctx);	if (!obj)	{		g_message("XPath eval key word xpath failed");		goto out;	}	if (xmlXPathNodeSetIsEmpty(obj->nodesetval))	{		g_message("XPath search keyword failed");		goto out;	}	nodeset = obj->nodesetval;	g_debug("Key word node set have %d object", nodeset->nodeNr);	clone = xmlCopyNode(nodeset->nodeTab[0], 1);	if (!clone)		goto out;	doc = xmlNewDoc("1.0");	if (!doc)		goto out;	xmlDocSetRootElement(doc, clone);	xmlXPathFreeContext(ctx);	ctx = NULL;	xmlXPathFreeObject(obj);	obj = NULL;	ctx = xmlXPathNewContext(doc);	if (!ctx)		goto out;	obj = xmlXPathEvalExpression("//span[@class='keyword']", ctx);	if (!obj)		goto out;	nodeset = obj->nodesetval;	tmp_str = xmlNodeGetContent(nodeset->nodeTab[0]->xmlChildrenNode);	g_debug("The word to search %s", tmp_str);	xmlFree(tmp_str);	tmp_str = NULL;	xmlXPathFreeObject(obj);	obj = NULL;	obj = xmlXPathEvalExpression("//ul/li", ctx);	if (!obj)		goto out;	if (xmlXPathNodeSetIsEmpty(obj->nodesetval))	{		g_message("Result value is empty");		goto out;	}	nodeset = obj->nodesetval;	result = g_ptr_array_sized_new(nodeset->nodeNr + 1);	for (i = 0; i < nodeset->nodeNr; ++i)	{		tmp_str = xmlNodeGetContent(nodeset->nodeTab[i]->xmlChildrenNode);		g_ptr_array_add(result, tmp_str);	}	g_ptr_array_add(result, NULL);//.........这里部分代码省略.........
开发者ID:No-name,项目名称:dict,代码行数:101,


示例20: check_themes

static void check_themes (void){	const char *session_name, *ret;	char *user_config_file, *cptr, *nptr, *fname;	GKeyFile *kf;	GError *err;	int count;	orig_lxsession_theme = "";	orig_openbox_theme = "";	// construct the file path for lxsession settings	session_name = g_getenv ("DESKTOP_SESSION");	if (!session_name) session_name = DEFAULT_SES;	user_config_file = g_build_filename (g_get_user_config_dir (), "lxsession/", session_name, "/desktop.conf", NULL);	// read in data from file to a key file structure	kf = g_key_file_new ();	if (g_key_file_load_from_file (kf, user_config_file, G_KEY_FILE_KEEP_COMMENTS | G_KEY_FILE_KEEP_TRANSLATIONS, NULL))	{		// get data from the key file		err = NULL;		ret = g_key_file_get_string (kf, "GTK", "sNet/ThemeName", &err);		if (err == NULL) orig_lxsession_theme = ret;	}	// construct the file path for openbox settings	fname = g_strconcat (g_ascii_strdown (session_name, -1), "-rc.xml", NULL);	user_config_file = g_build_filename (g_get_user_config_dir (), "openbox/", fname, NULL);	g_free (fname);	// read in data from XML file	xmlInitParser ();	LIBXML_TEST_VERSION	xmlDocPtr xDoc = xmlParseFile (user_config_file);	if (xDoc)	{		xmlXPathContextPtr xpathCtx = xmlXPathNewContext (xDoc);		xmlXPathObjectPtr xpathObj = xmlXPathEvalExpression ((xmlChar *) "/*[local-name()='openbox_config']/*[local-name()='theme']", xpathCtx);		// find relevant node and read value		for (count = 0; count < xpathObj->nodesetval->nodeNr; count++)		{			xmlNode *node = xpathObj->nodesetval->nodeTab[count];			xmlAttr *attr = node->properties;			xmlNode *cur_node = NULL;			for (cur_node = node->children; cur_node; cur_node = cur_node->next)			{				if (cur_node->type == XML_ELEMENT_NODE)				{					if (!strcmp (cur_node->name, "name"))						orig_openbox_theme = xmlNodeGetContent (cur_node);				}			}		}		// cleanup XML		xmlXPathFreeObject (xpathObj);		xmlXPathFreeContext (xpathCtx);		xmlSaveFile (user_config_file, xDoc);		xmlFreeDoc (xDoc);		xmlCleanupParser ();	}	g_free (user_config_file);	// set the new themes if needed	if (strcmp ("PiX", orig_lxsession_theme))	{		set_lxsession_theme ("PiX");		if (needs_refresh) system (RELOAD_LXSESSION);	}	if (strcmp ("PiX", orig_openbox_theme))	{		set_openbox_theme ("PiX");		system (RELOAD_OPENBOX);	}}
开发者ID:l10n-tw,项目名称:pipanel,代码行数:78,


示例21: parseState

/*===========================================================================*/static int parseState(xmlDocPtr doc, xmlNodePtr cur, ghmm_xmlfile* f, int * inDegree, int * outDegree, int modelNo) {#define CUR_PROC "parseState"  int i, error, order=0, state=-1442, fixed=-985, tied=-9354, M, aprox, label;  int curX=0, curY=0;  double pi, prior;  double *emissions = NULL;  char *desc = NULL;  char *s = NULL, *estr;  int rev, stateFixed=1;  ghmm_cstate *newcstate;  ghmm_c_emission *emission;  xmlNodePtr elem, child, multichild;  state = getIntAttribute(cur, "id", &error);  pi = getDoubleAttribute(cur, "initial", &error);  if (error) {    estr = ighmm_mprintf(NULL, 0, "can't read required intial probability for"                         "state %d", state);    GHMM_LOG(LERROR, estr);    goto STOP;  } else  desc = xmlGetProp(cur, BAD_CAST "desc");  elem = cur->children;  while (elem!=NULL) {    /* ======== silent state ============================================== */    if ((!xmlStrcmp(elem->name, BAD_CAST "silent"))) {      switch (f->modelType & PTR_TYPE_MASK) {      case (GHMM_kDiscreteHMM):        f->model.d[modelNo]->silent[state] = 1;        break;      case (GHMM_kDiscreteHMM+GHMM_kTransitionClasses):        f->model.ds[modelNo]->silent[state] = 1;        break;      case (GHMM_kDiscreteHMM+GHMM_kPairHMM):      case (GHMM_kDiscreteHMM+GHMM_kPairHMM+GHMM_kTransitionClasses):        f->model.dp[modelNo]->silent[state] = 1;        break;      default:        GHMM_LOG(LERROR, "invalid modelType");        goto STOP;      }    }    /* ======== discrete state (possible higher order) ==================== */    if ((!xmlStrcmp(elem->name, BAD_CAST "discrete"))) {      assert((f->modelType & GHMM_kDiscreteHMM) && ((f->modelType & GHMM_kPairHMM) == 0));      /* fixed is a propety of the distribution and optional */      fixed = getIntAttribute(elem, "fixed", &error);      if (error)        fixed = 0;      /* order is optional for discrete */      if (f->modelType & GHMM_kHigherOrderEmissions) {        order = getIntAttribute(elem, "order", &error);        if (error)          order = 0;      }      rev = getIntAttribute(cur, "rev", &error);      if (error)        rev = 0;      /* parsing emission probabilities */      s = (char *)xmlNodeGetContent(elem);      switch (f->modelType & PTR_TYPE_MASK) {      case (GHMM_kDiscreteHMM):        f->model.d[modelNo]->s[state].desc = desc;        f->model.d[modelNo]->s[state].pi = pi;        f->model.d[modelNo]->s[state].fix = fixed;        if (f->modelType & GHMM_kHigherOrderEmissions) {          f->model.d[modelNo]->order[state] = order;          if (f->model.d[modelNo]->maxorder < order) {            f->model.d[modelNo]->maxorder = order;            estr = ighmm_mprintf(NULL, 0, "Updated maxorder to %d/n",                                 f->model.d[modelNo]->maxorder);            GHMM_LOG(LDEBUG, estr);            m_free(estr);          }        }        ARRAY_MALLOC(emissions, pow(f->model.d[modelNo]->M, order+1));        parseCSVList(s, pow(f->model.d[modelNo]->M, order+1), emissions, rev);        free(f->model.d[modelNo]->s[state].b);        f->model.d[modelNo]->s[state].b = emissions;        break;      case (GHMM_kDiscreteHMM+GHMM_kTransitionClasses):        f->model.ds[modelNo]->s[state].desc = desc;        f->model.ds[modelNo]->s[state].pi = pi;        f->model.ds[modelNo]->s[state].fix = fixed;        if (f->modelType & GHMM_kHigherOrderEmissions)          f->model.ds[modelNo]->order[state] = order;        ARRAY_MALLOC(emissions, pow(f->model.ds[modelNo]->M, order+1));//.........这里部分代码省略.........
开发者ID:ramasamyz,项目名称:CKD_Analysis,代码行数:101,


示例22: oilsIDLInit

//.........这里部分代码省略.........									"Permacrud context_field list is %s", prop_str );							map = osrfStringArrayTokenize( prop_str, ' ' );							osrfHashSet( action_def_hash, map, "local_context");							xmlFree( prop_str );							osrfHash* foreign_context = osrfNewHash();							osrfHashSet( action_def_hash, foreign_context, "foreign_context");							xmlNodePtr _f = _a->children;							while(_f) {								if ( strcmp( (char*)_f->name, "context" ) ) {									_f = _f->next;									continue;								}								if( (prop_str = (char*)xmlGetNoNsProp(_f, BAD_CAST "link")) ) {									osrfLogDebug(OSRF_LOG_MARK,										"Permacrud context link definition is %s", prop_str );									osrfHash* _tmp_fcontext = osrfNewHash();									// Store pointers to elements already stored									// from the <link> aggregate									osrfHash* _flink = osrfHashGet( current_links_hash, prop_str );									osrfHashSet( _tmp_fcontext, osrfHashGet(_flink, "field"), "fkey" );									osrfHashSet( _tmp_fcontext, osrfHashGet(_flink, "key"), "field" );									xmlFree( prop_str );								    if( (prop_str = (char*)xmlGetNoNsProp(_f, BAD_CAST "jump")) )									    osrfHashSet( _tmp_fcontext, osrfStringArrayTokenize( prop_str, '.' ), "jump" );									xmlFree( prop_str );									// Tokenize field attribute into an osrfStringArray									char * field_list = (char*) xmlGetProp(_f, BAD_CAST "field");									if( field_list )										osrfLogDebug(OSRF_LOG_MARK,											"Permacrud foreign context field list is %s", field_list );									map = osrfStringArrayTokenize( field_list, ' ' );									osrfHashSet( _tmp_fcontext, map, "context");									xmlFree( field_list );									// Insert the new hash into a hash attached to the parent node									osrfHashSet( foreign_context, _tmp_fcontext, osrfHashGet( _flink, "class" ) );								} else {									if( (prop_str = (char*)xmlGetNoNsProp(_f, BAD_CAST "field") )) {										char* map_list = prop_str;										osrfLogDebug(OSRF_LOG_MARK,											"Permacrud local context field list is %s", prop_str );													if (strlen( map_list ) > 0) {											char* st_tmp = NULL;											char* _map_class = strtok_r(map_list, " ", &st_tmp);											osrfStringArrayAdd(												osrfHashGet( action_def_hash, "local_context"), _map_class);																				while ((_map_class = strtok_r(NULL, " ", &st_tmp))) {												osrfStringArrayAdd(													osrfHashGet( action_def_hash, "local_context"), _map_class);											}										}										xmlFree(map_list);									}								}								_f = _f->next;							}							_a = _a->next;						}						_l = _l->next;					}				}				if (!strcmp( (char*)_cur->name, "source_definition" )) {					char* content_str;					if( (content_str = (char*)xmlNodeGetContent(_cur)) ) {						osrfLogDebug(OSRF_LOG_MARK, "Using source definition '%s' for class %s",							content_str, current_class_name );						osrfHashSet(							class_def_hash,							content_str,							"source_definition"						);					}				}				_cur = _cur->next;			} // end while		}		kid = kid->next;	} // end while	osrfLogInfo(OSRF_LOG_MARK, "...IDL XML parsed");	return idlHash;}
开发者ID:CloCkWeRX,项目名称:Evergreen,代码行数:101,


示例23: xml_to_node

static void xml_to_node(xmlNodePtr xml_node, plist_t * plist_node){    xmlNodePtr node = NULL;    plist_data_t data = NULL;    plist_t subnode = NULL;    //for string    long len = 0;    int type = 0;    if (!xml_node)        return;    for (node = xml_node->children; node; node = node->next)    {        while (node && !xmlStrcmp(node->name, XPLIST_TEXT))            node = node->next;        if (!node)            break;        if (!xmlStrcmp(node->name, BAD_CAST("comment"))) {            continue;        }        data = plist_new_plist_data();        subnode = plist_new_node(data);        if (*plist_node)            node_attach(*plist_node, subnode);        else            *plist_node = subnode;        if (!xmlStrcmp(node->name, XPLIST_TRUE))        {            data->boolval = TRUE;            data->type = PLIST_BOOLEAN;            data->length = 1;            continue;        }        if (!xmlStrcmp(node->name, XPLIST_FALSE))        {            data->boolval = FALSE;            data->type = PLIST_BOOLEAN;            data->length = 1;            continue;        }        if (!xmlStrcmp(node->name, XPLIST_INT))        {            xmlChar *strval = xmlNodeGetContent(node);            int is_negative = 0;            char *str = (char*)strval;            if ((str[0] == '-') || (str[0] == '+')) {                if (str[0] == '-') {                    is_negative = 1;                }                str++;            }            char* endp = NULL;            data->intval = strtoull((char*)str, &endp, 0);            if ((endp != NULL) && (strlen(endp) > 0)) {                fprintf(stderr, "%s: integer parse error: string contains invalid characters: '%s'/n", __func__, endp);            }            if (is_negative || (data->intval <= INT64_MAX)) {                int64_t v = data->intval;                if (is_negative) {                    v = -v;                }                data->intval = (uint64_t)v;                data->length = 8;            } else {                data->length = 16;            }            data->type = PLIST_UINT;            xmlFree(strval);            continue;        }        if (!xmlStrcmp(node->name, XPLIST_REAL))        {            xmlChar *strval = xmlNodeGetContent(node);            data->realval = atof((char *) strval);            data->type = PLIST_REAL;            data->length = 8;            xmlFree(strval);            continue;        }        if (!xmlStrcmp(node->name, XPLIST_DATE))        {            xmlChar *strval = xmlNodeGetContent(node);            time_t timev = 0;            if (strlen((const char*)strval) >= 11) {                struct tm btime;                struct tm* tm_utc;                parse_date((const char*)strval, &btime);                timev = mktime(&btime);                tm_utc = gmtime(&timev);                timev -= (mktime(tm_utc) - timev);//.........这里部分代码省略.........
开发者ID:EchoLiao,项目名称:libplist,代码行数:101,


示例24: pres_watcher_allowed

int pres_watcher_allowed(subs_t* subs){    xmlDocPtr xcap_tree= NULL;    xmlNodePtr node= NULL,  actions_node = NULL;    xmlNodePtr sub_handling_node = NULL;    char* sub_handling = NULL;	    subs->status= PENDING_STATUS;    subs->reason.s= NULL;    subs->reason.len= 0;    if (subs->auth_rules_doc== NULL)	return 0;    xcap_tree= xmlParseMemory(subs->auth_rules_doc->s,			      subs->auth_rules_doc->len);    if (xcap_tree== NULL) {	LM_ERR("parsing xml memory/n");	return -1;    }    node= get_rule_node(subs, xcap_tree);    if (node== NULL) {	xmlFreeDoc(xcap_tree);	return 0;	}    /* process actions */	    actions_node = xmlNodeGetChildByName(node, "actions");    if (actions_node == NULL) {	LM_DBG("actions_node NULL/n");	xmlFreeDoc(xcap_tree);	return 0;    }    LM_DBG("actions_node->name= %s/n", actions_node->name);			    sub_handling_node = xmlNodeGetChildByName(actions_node, "sub-handling");    if (sub_handling_node== NULL) {	LM_DBG("sub_handling_node NULL/n");	xmlFreeDoc(xcap_tree);	return 0;    }    sub_handling = (char*)xmlNodeGetContent(sub_handling_node);    LM_DBG("sub_handling_node->name= %s/n", sub_handling_node->name);    LM_DBG("sub_handling_node->content= %s/n", sub_handling);	    if (sub_handling == NULL) {	LM_ERR("Couldn't get sub-handling content/n");	xmlFreeDoc(xcap_tree);	return -1;    }    if (strncmp((char*)sub_handling, "block", 5) == 0) {	subs->status = TERMINATED_STATUS;;	subs->reason.s= "rejected";	subs->reason.len = 8;    } else		if (strncmp((char*)sub_handling, "confirm", 7) == 0) {	    subs->status = PENDING_STATUS;	} else	    if (strncmp((char*)sub_handling , "polite-block", 12) == 0) {		subs->status = ACTIVE_STATUS;		subs->reason.s= "polite-block";		subs->reason.len = 12;	    }	else	    if (strncmp((char*)sub_handling, "allow", 5) == 0) {		subs->status = ACTIVE_STATUS;		subs->reason.s = NULL;	    }	    else {		LM_ERR("unknown subscription handling action/n");		xmlFreeDoc(xcap_tree);		xmlFree(sub_handling);		return -1;	    }	xmlFreeDoc(xcap_tree);    xmlFree(sub_handling);    return 0;}
开发者ID:kiryu,项目名称:kamailio,代码行数:82,


示例25: get_rule_node

xmlNodePtr get_rule_node(subs_t* subs, xmlDocPtr xcap_tree){    str w_uri = {0, 0};    char* id = NULL, *domain = NULL, *time_cont= NULL;    int apply_rule = -1;    xmlNodePtr ruleset_node = NULL, node1= NULL, node2= NULL;    xmlNodePtr cond_node = NULL, except_node = NULL;    xmlNodePtr identity_node = NULL;    xmlNodePtr iden_child;    xmlNodePtr validity_node, time_node;    time_t t_init, t_fin, t;    int valid= 0;    uandd_to_uri(subs->from_user, subs->from_domain, &w_uri);    if (w_uri.s == NULL) {	LM_ERR("while creating uri/n");	return NULL;    }    ruleset_node = xmlDocGetNodeByName(xcap_tree, "ruleset", NULL);    if (ruleset_node == NULL) {	LM_DBG("ruleset_node NULL/n");	goto error;    }	    for (node1 = ruleset_node->children; node1; node1 = node1->next) {	if (xmlStrcasecmp(node1->name, (unsigned char*)"text") == 0)	    continue;	/* process conditions */	LM_DBG("node1->name= %s/n", node1->name);		cond_node = xmlNodeGetChildByName(node1, "conditions");	if(cond_node == NULL) {	    LM_DBG("cond node NULL/n");	    goto error;	}	LM_DBG("cond_node->name= %s/n", cond_node->name);	validity_node = xmlNodeGetChildByName(cond_node, "validity");	if (validity_node != NULL) {	    LM_DBG("found validity tag/n");	    	    t= time(NULL);			    /* search all from-until pair */	    for (time_node = validity_node->children; time_node;		time_node = time_node->next) {		if (xmlStrcasecmp(time_node->name, (unsigned char*)"from")!= 0)		    continue;		time_cont= (char*)xmlNodeGetContent(time_node);		t_init= xml_parse_dateTime(time_cont);		xmlFree(time_cont);		if (t_init< 0) {		    LM_ERR("failed to parse xml dateTime/n");		    goto error;		}		if (t< t_init) {		    LM_DBG("the lower time limit is not respected/n");		    continue;		}						time_node= time_node->next;		while (1) {		    if (time_node == NULL) {			LM_ERR("bad formatted xml doc:until child not found in"			       " validity pair/n");			goto error;		    }		    if( xmlStrcasecmp(time_node->name, 				      (unsigned char*)"until")== 0)			break;		    time_node= time_node->next;		}						time_cont = (char*)xmlNodeGetContent(time_node);		t_fin= xml_parse_dateTime(time_cont);		xmlFree(time_cont);				if (t_fin< 0) {		    LM_ERR("failed to parse xml dateTime/n");		    goto error;		}					if (t <= t_fin) {		    LM_DBG("the rule is active at this time/n");		    valid= 1;		}				    }			    if (!valid) {		LM_DBG("the rule is not active at this time/n");		continue;	    }	    	}		identity_node = xmlNodeGetChildByName(cond_node, "identity");	if (identity_node == NULL) {//.........这里部分代码省略.........
开发者ID:kiryu,项目名称:kamailio,代码行数:101,


示例26: request

voidRL::Heap::edit (){  Ekiga::FormRequestSimple request(sigc::mem_fun (this, &RL::Heap::on_edit_form_submitted));  std::string name_str;  std::string root_str;  std::string username_str;  std::string password_str;  std::string user_str;  bool writable = false;  {    xmlChar* str = xmlNodeGetContent (root);    if (str != NULL) {      root_str = (const char*)str;      xmlFree (str);    }  }  {    xmlChar* str = xmlNodeGetContent (user);    if (str != NULL) {      user_str = (const char*)str;      xmlFree (str);    }  }  {    xmlChar* str = xmlNodeGetContent (username);    if (str != NULL) {      username_str = (const char*)str;      xmlFree (str);    }  }  {    xmlChar* str = xmlNodeGetContent (password);    if (str != NULL) {      password_str = (const char*)str;      xmlFree (str);    }  }  {    xmlChar* str = xmlGetProp (node, BAD_CAST "writable");    if (str != NULL) {      if (xmlStrEqual (str, BAD_CAST "1"))	writable = true;      xmlFree (str);    }  }  request.title (_("Edit contact list properties"));  request.instructions (_("Please edit the following fields (no identifier"			  " means global)"));  request.text ("name", _("Contact list's name"), get_name ());  /* "Document" used as a name -- uri point to the root of a document tree */  request.text ("root", _("Document root"), root_str);  request.text ("user", _("Identifier"), user_str);  request.boolean ("writable", _("Writable"), writable);  request.text ("username", _("Server username"), username_str);  request.private_text ("password", _("Server password"), password_str);  if (!questions.handle_request (&request)) {    // FIXME: better error reporting#ifdef __GNUC__    std::cout << "Unhandled form request in "	      << __PRETTY_FUNCTION__ << std::endl;#endif  }}
开发者ID:NeoWing,项目名称:ekiga-3.2.7,代码行数:76,


示例27: cfg_lock

void FissionReactor::setConfig(const Vocabulary& v, const xmlNodePtr config_ptr){	// first set config options for the Reactor base class	ConfigWriteLock cfg_lock(*this);	Reactor::setConfig(v, config_ptr);	// get the input event type	std::string config_str;	if (! ConfigManager::getConfigOption(INPUT_EVENT_TYPE_ELEMENT_NAME, config_str, config_ptr))		throw EmptyInputEventTypeException(getId());	// find vocabulary term for input event type	Vocabulary::TermRef term_ref = v.findTerm(config_str);	if (term_ref == Vocabulary::UNDEFINED_TERM_REF)		throw UnknownTermException(config_str);	m_input_event_type = v[term_ref];	// make sure that term is object/event type	if (m_input_event_type.term_type != Vocabulary::TYPE_OBJECT)		throw NotAnObjectException(config_str);	// get the input event term	if (! ConfigManager::getConfigOption(INPUT_EVENT_TERM_ELEMENT_NAME, config_str, config_ptr))		throw EmptyInputEventTermException(getId());	// find vocabulary term for input event term	term_ref = v.findTerm(config_str);	if (term_ref == Vocabulary::UNDEFINED_TERM_REF)		throw UnknownTermException(config_str);	m_input_event_term = v[term_ref];	// only string types are currently supported for input event term	switch (m_input_event_term.term_type) {	case Vocabulary::TYPE_NULL:	case Vocabulary::TYPE_OBJECT:	case Vocabulary::TYPE_INT8:	case Vocabulary::TYPE_INT16:	case Vocabulary::TYPE_INT32:	case Vocabulary::TYPE_UINT8:	case Vocabulary::TYPE_UINT16:	case Vocabulary::TYPE_UINT32:	case Vocabulary::TYPE_INT64:	case Vocabulary::TYPE_UINT64:	case Vocabulary::TYPE_FLOAT:	case Vocabulary::TYPE_DOUBLE:	case Vocabulary::TYPE_LONG_DOUBLE:	case Vocabulary::TYPE_DATE_TIME:	case Vocabulary::TYPE_DATE:	case Vocabulary::TYPE_TIME:		throw TermNotStringException(config_str);		break;	case Vocabulary::TYPE_SHORT_STRING:	case Vocabulary::TYPE_STRING:	case Vocabulary::TYPE_LONG_STRING:	case Vocabulary::TYPE_CHAR:	case Vocabulary::TYPE_BLOB:	case Vocabulary::TYPE_ZBLOB:		break;	// these are all OK	}	// get the codec to use	boost::mutex::scoped_lock codec_lock(m_codec_mutex);	if (! ConfigManager::getConfigOption(CODEC_ELEMENT_NAME, m_codec_id, config_ptr))		throw EmptyCodecException(getId());	m_codec_ptr = getCodecFactory().getCodec(m_codec_id);		PION_ASSERT(m_codec_ptr);	codec_lock.unlock();	// check if we should copy all terms from original event	m_copy_all_terms = false;	std::string copy_all_terms_str;	if (ConfigManager::getConfigOption(COPY_ALL_TERMS_ELEMENT_NAME,									   copy_all_terms_str, config_ptr))	{		if (copy_all_terms_str == "true")			m_copy_all_terms = true;	}	// get list of terms to copy from original event	m_copy_terms.clear();	xmlNodePtr copy_term_node = config_ptr;	while ((copy_term_node = ConfigManager::findConfigNodeByName(COPY_TERM_ELEMENT_NAME, copy_term_node)) != NULL) {		xmlChar *xml_char_ptr = xmlNodeGetContent(copy_term_node);		if (xml_char_ptr != NULL) {			const std::string copy_term_str(reinterpret_cast<char*>(xml_char_ptr));			xmlFree(xml_char_ptr);			if (! copy_term_str.empty()) {				// find the term in the Vocabulary				term_ref = v.findTerm(copy_term_str);				if (term_ref == Vocabulary::UNDEFINED_TERM_REF)					throw UnknownTermException(copy_term_str);				// add it to the copy terms collection				m_copy_terms.push_back(v[term_ref]);			}		}		// step to the next copy term		copy_term_node = copy_term_node->next;	}//.........这里部分代码省略.........
开发者ID:acmorrow,项目名称:pion-core,代码行数:101,


示例28: xmlNewChild

voidRL::Heap::on_new_entry_form_submitted (bool submitted,				       Ekiga::Form& result){  if (!submitted)    return;  std::string entry_name = result.text ("name");  std::string entry_uri = result.text ("uri");  std::set<std::string> entry_groups = result.editable_set ("groups");  xmlNodePtr entry_node = xmlNewChild (list_node, NULL,				       BAD_CAST "entry", NULL);  xmlSetProp (entry_node, BAD_CAST "uri",	      BAD_CAST robust_xmlEscape (doc.get (), entry_uri).c_str ());  xmlNewChild (entry_node, NULL, BAD_CAST "display-name",	       BAD_CAST robust_xmlEscape (doc.get (), entry_name).c_str ());  xmlNsPtr ns = xmlSearchNsByHref (doc.get (), entry_node,				   BAD_CAST "http://www.ekiga.org");  if (ns == NULL) {    // FIXME: we should handle the case, even if it shouldn't happen  }  for (std::set<std::string>::const_iterator iter = entry_groups.begin ();       iter != entry_groups.end ();       ++iter) {    xmlNewChild (entry_node, ns, BAD_CAST "group",		 BAD_CAST robust_xmlEscape (doc.get (), *iter).c_str ());  }  xmlBufferPtr buffer = xmlBufferCreate ();  int res = xmlNodeDump (buffer, doc.get (), entry_node, 0, 0);  if (res >= 0) {    std::string root_str;    std::string username_str;    std::string password_str;    std::string user_str;    {      xmlChar* str = xmlNodeGetContent (root);      if (str != NULL)	root_str = (const char*)str;    }    {      xmlChar* str = xmlNodeGetContent (user);      if (str != NULL)	user_str = (const char*)str;    }    {      xmlChar* str = xmlNodeGetContent (username);      if (str != NULL)	username_str = (const char*)str;    }    {      xmlChar* str = xmlNodeGetContent (password);      if (str != NULL)	password_str = (const char*)str;    }    gmref_ptr<XCAP::Path> path(new XCAP::Path (root_str, "resource-lists",					       user_str));    path->set_credentials (username_str, password_str);    path = path->build_child ("resource-lists");    path = path->build_child ("list");    path = path->build_child_with_attribute ("entry", "uri", entry_uri);    gmref_ptr<XCAP::Core> xcap(services.get ("xcap-core"));    xcap->write (path, "application/xcap-el+xml",		 (const char*)xmlBufferContent (buffer),		 sigc::mem_fun (this, &RL::Heap::new_entry_result));  }  xmlBufferFree (buffer);}
开发者ID:NeoWing,项目名称:ekiga-3.2.7,代码行数:75,



注:本文中的xmlNodeGetContent函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ xmlNodeListGetString函数代码示例
C++ xmlNodeDump函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。