当前位置: 首页>>代码示例>>C++>>正文


C++ xmlNodeGetContent函数代码示例

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


在下文中一共展示了xmlNodeGetContent函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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,代码来源:wsman-libxml2-binding.c

示例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,代码来源:LastFM.c

示例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,代码来源:test_jalp_log_severity_xml.c

示例4: as_validator_check_children_quick

/**
 * as_validator_check_children_quick:
 **/
static void
as_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,代码来源:as-validator.c

示例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,代码来源:ws_eag_conf.c

示例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,代码来源:lxpath.c

示例7: default_parse_item

static void
default_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,代码来源:propono-connection.c

示例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,代码来源:JS_Tree.cpp

示例9: xmlSecXPathDataNodeRead

static int
xmlSecXPathDataNodeRead(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,代码来源:xpath.c

示例10: xmlSecOpenSSLHmacNodeRead

static int
xmlSecOpenSSLHmacNodeRead(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,代码来源:hmac.c

示例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,代码来源:pandora_rp9.cpp

示例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,代码来源:pandora_rp9.cpp

示例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,代码来源:xnode.C

示例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,代码来源:uithemesetting.cpp

示例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 xmlDocPtr
decode_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,代码来源:gda-web-util.c


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