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


C++ xmlTextReaderNodeType函数代码示例

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


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

示例1: TileMapLayer_parse_data

TileMapParseStatus TileMapLayer_parse_data(xmlTextReaderPtr reader,
                                           TileMap *map, TileMapLayer *layer) {
  TileMapParseStatus status = TILEMAP_PARSE_OK;
  
  while (xmlTextReaderMoveToNextAttribute(reader)) {
    xmlChar *attrName = xmlTextReaderName(reader);
    xmlChar *attrVal = xmlTextReaderValue(reader);
    
    if (streq(attrName, "encoding")) {
      check(streq(attrVal, "base64"), "Incorrect layer data encoding");
    } else if (streq(attrName, "compression")) {
      check(streq(attrVal, "gzip"), "Incorrect layer data compression");
    }
  }
  
  while (xmlTextReaderRead(reader)) {
    xmlChar *childName = xmlTextReaderName(reader);
    if (xmlTextReaderNodeType(reader) == XML_ELEMENT_DECL &&
        streq(childName, "data")) {
      break;
    } else if (xmlTextReaderNodeType(reader) == XML_TEXT_NODE) {
      int tile_count = 0;
      extract_gids_from_encoded_data(xmlTextReaderValue(reader),
                                     &(layer->tile_gids), &tile_count);
      check(tile_count == map->rows * map->cols, "Inconsistent layer size");
      layer->gid_count = tile_count;
    }
  }
  
  return status;
error:
  return TILEMAP_PARSE_INVALID_FORMAT;
}
开发者ID:mdegs,项目名称:dabes_engine,代码行数:33,代码来源:tile_map_parse.c

示例2: parse_properties

static int parse_properties(xmlTextReaderPtr reader, tmx_property **prop_headadr) {
	tmx_property *res;
	int curr_depth;
	const char *name;

	curr_depth = xmlTextReaderDepth(reader);

	/* Parse each child */
	do {
		if (xmlTextReaderRead(reader) != 1) return 0; /* error_handler has been called */

		if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT) {
			name = (char*)xmlTextReaderConstName(reader);
			if (!strcmp(name, "property")) {
				if (!(res = alloc_prop())) return 0;
				res->next = *prop_headadr;
				*prop_headadr = res;

				if (!parse_property(reader, res)) return 0;

			} else { /* Unknow element, skip its tree */
				if (xmlTextReaderNext(reader) != 1) return 0;
			}
		}
	} while (xmlTextReaderNodeType(reader) != XML_READER_TYPE_END_ELEMENT ||
	         xmlTextReaderDepth(reader) != curr_depth);
	return 1;
}
开发者ID:V0idExp,项目名称:tmx,代码行数:28,代码来源:tmx_xml.c

示例3: cxActionRootLoadCodesWithReader

static void cxActionRootLoadCodesWithReader(cxAny pav,xmlTextReaderPtr reader)
{
    cxActionRoot this = pav;
    cxReaderAttrInfo *info = cxReaderAttrInfoMake(reader, pav, pav);
    while(xmlTextReaderRead(reader) && !this->isError){
        if(xmlTextReaderNodeType(reader) != XML_READER_TYPE_ELEMENT){
            continue;
        }
        cxConstChars temp = cxXMLReadElementName(reader);
        if(!ELEMENT_IS_TYPE(cxActionRoot)){
            continue;
        }
        cxObjectReadAttrRun(info);
        break;
    }
    while(xmlTextReaderRead(reader)){
        CX_CONTINUE(xmlTextReaderNodeType(reader) != XML_READER_TYPE_ELEMENT);
        
        cxConstChars id = cxXMLAttr(reader, "id");
        CX_CONTINUE(id == NULL);
        
        cxString code = cxXMLReaderReadOuterXml(reader);
        cxHashSet(this->codes, cxHashStrKey(id), code);
    }
}
开发者ID:lostsakya,项目名称:cxEngine,代码行数:25,代码来源:cxActionRoot.c

示例4: xmlconfig_load_node

static int
xmlconfig_load_node( xmlTextReaderPtr reader )
{
	int ret;
	const xmlChar *name;
        
	ret = xmlTextReaderRead( reader );
	while ( ret == 1 ) {
		name = xmlTextReaderConstName( reader );
		if ( name &&
                    (XML_READER_TYPE_END_ELEMENT != xmlTextReaderNodeType( reader )) &&
                    ( 0 == xmlStrncmp( name, (const xmlChar *)"Node", 7 ) ) )
		{
			const xmlChar *id = xmlTextReaderGetAttribute( reader, (const xmlChar*)"id" );
			const xmlChar *nname = xmlTextReaderGetAttribute( reader, (const xmlChar*)"name" );
			const xmlChar *type = xmlTextReaderGetAttribute( reader, (const xmlChar*)"type" );
                        
			SYSLOG_DEBUG( "xmlconfig_load_node: Name=%s Id=%s Type=%s",
                                     	nname, id, type );
                        
                        ret = zw_node_set_label( atoi((const char*)id), (char *)nname );
                        if ( ret )
                                SYSLOG_DEBUG( "xmlconfig_load_node: set label for node(%d) failed %d", atoi((const char*)id), ret );
		}
		if ( (XML_READER_TYPE_END_ELEMENT == xmlTextReaderNodeType( reader )) &&
			(0 == xmlStrncmp(name, (const xmlChar *)"NodeConfig", 10)))
			break;
                
		ret = xmlTextReaderRead( reader );
	}
	return ret;
}
开发者ID:pmnair,项目名称:zwave-remote,代码行数:32,代码来源:xmlconfig.c

示例5: __attribute__nonnull__

static char *parse_text_element(xmlTextReaderPtr reader, char *name)
{

	char *string = NULL;

	__attribute__nonnull__(reader);
	__attribute__nonnull__(name);

	// parse string element attributes here (like xml:lang)

	while (xmlTextReaderNextNode(reader)) {
		if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_END_ELEMENT &&
		    !xmlStrcmp(xmlTextReaderConstLocalName(reader), BAD_CAST name)) {
			return string;
		}

		switch (xmlTextReaderNodeType(reader)) {
		case XML_READER_TYPE_TEXT:
			string = (char *)xmlTextReaderValue(reader);
			break;
		default:
			oscap_seterr(OSCAP_EFAMILY_OSCAP, "Unknown XML element in platform");
			break;
		}
	}
	return string;
}
开发者ID:GautamSatish,项目名称:openscap,代码行数:27,代码来源:cpelang_priv.c

示例6: processNode

static void processNode(xmlTextReaderPtr reader, struct osmdata_t *osmdata) {
    xmlChar *name;
    name = xmlTextReaderName(reader);
    if (name == NULL)
        name = xmlStrdup(BAD_CAST "--");
	
    switch(xmlTextReaderNodeType(reader)) {
        case XML_READER_TYPE_ELEMENT:
	    StartElement(reader, name, osmdata);
            if (xmlTextReaderIsEmptyElement(reader))
	        EndElement(name, osmdata); /* No end_element for self closing tags! */
            break;
        case XML_READER_TYPE_END_ELEMENT:
	    EndElement(name, osmdata);
            break;
        case XML_READER_TYPE_SIGNIFICANT_WHITESPACE:
            /* Ignore */
            break;
        default:
            fprintf(stderr, "Unknown node type %d\n", xmlTextReaderNodeType(reader));
            break;
    }

    xmlFree(name);
}
开发者ID:alexasahis,项目名称:osm2pgsql,代码行数:25,代码来源:parse-xml2.c

示例7: xmlTextReaderAdvanceToNextStartOrEndElement

static int xmlTextReaderAdvanceToNextStartOrEndElement(xmlTextReaderPtr reader) {
  int status = xmlTextReaderRead(reader);
  while (status && xmlTextReaderNodeType(reader) != XML_READER_TYPE_ELEMENT && xmlTextReaderNodeType(reader) != XML_READER_TYPE_END_ELEMENT) {
    status = xmlTextReaderRead(reader);
  }
  return status;
}
开发者ID:bestdpf,项目名称:paper,代码行数:7,代码来源:enunciate-common.c

示例8: xmlTextReaderSkipElement

static int xmlTextReaderSkipElement(xmlTextReaderPtr reader) {
  int status = xmlTextReaderNext(reader);
  while (status && xmlTextReaderNodeType(reader) != XML_READER_TYPE_ELEMENT && xmlTextReaderNodeType(reader) != XML_READER_TYPE_END_ELEMENT) {
    status = xmlTextReaderRead(reader);
  }
  return status;
}
开发者ID:bestdpf,项目名称:paper,代码行数:7,代码来源:enunciate-common.c

示例9: openioc_parse_indicator

static int openioc_parse_indicator(xmlTextReaderPtr reader, struct openioc_hash ** elems)
{
    const xmlChar * name;
    int rc = CL_SUCCESS;

    while (1) {
        name = openioc_read(reader);
        if (name == NULL)
            return rc;
        if (xmlStrEqual(name, (const xmlChar *)"Indicator") && 
            xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT) {
            rc = openioc_parse_indicator(reader, elems);
            if (rc != CL_SUCCESS) {
                cli_dbgmsg("openioc_parse: openioc_parse_indicator recursion error.\n");
                break;
            }
        } else if (xmlStrEqual(name, (const xmlChar *)"IndicatorItem") && 
            xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT) {
            rc = openioc_parse_indicatoritem(reader, elems);
            if (rc != CL_SUCCESS) {
                break;
            }
        } else if (xmlStrEqual(name, (const xmlChar *)"Indicator") &&
                   xmlTextReaderNodeType(reader) == XML_READER_TYPE_END_ELEMENT) {
            break;
        }
    }
    return rc;
}
开发者ID:CyberIntelMafia,项目名称:clamav-devel,代码行数:29,代码来源:openioc.c

示例10: openioc_parse_indicatoritem

static int openioc_parse_indicatoritem(xmlTextReaderPtr reader, struct openioc_hash ** elems)
{
    const xmlChar * name;
    int rc = CL_SUCCESS;
    int context_hash = 0;

    while (1) {
        name = openioc_read(reader);
        if (name == NULL)
            break;
        if (xmlStrEqual(name, (const xmlChar *)"Context") && 
            xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT) {
            context_hash = openioc_is_context_hash(reader);
        } else if (xmlStrEqual(name, (const xmlChar *)"Content") && 
            xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT) {
            rc = openioc_parse_content(reader, elems, context_hash);
            if (rc != CL_SUCCESS) {
                break;
            }
        } else if (xmlStrEqual(name, (const xmlChar *)"IndicatorItem") &&
                   xmlTextReaderNodeType(reader) == XML_READER_TYPE_END_ELEMENT) {
            break;
        }
    }
    return rc;
}
开发者ID:CyberIntelMafia,项目名称:clamav-devel,代码行数:26,代码来源:openioc.c

示例11: xmlconfig_load_timer

static int
xmlconfig_load_timer( xmlTextReaderPtr reader )
{
	int ret;
	const xmlChar *name;
        
	ret = xmlTextReaderRead( reader );
	while ( ret == 1 ) {
		name = xmlTextReaderConstName( reader );
		if ( name &&
                    (XML_READER_TYPE_END_ELEMENT != xmlTextReaderNodeType( reader )) &&
                    ( 0 == xmlStrncmp( name, (const xmlChar *)"Timer", 7 ) ) )
		{
			const xmlChar *nodeid = xmlTextReaderGetAttribute( reader, (const xmlChar*)"node" );
			const xmlChar *tname = xmlTextReaderGetAttribute( reader, (const xmlChar*)"name" );
			const xmlChar *on = xmlTextReaderGetAttribute( reader, (const xmlChar*)"on" );
			const xmlChar *off = xmlTextReaderGetAttribute( reader, (const xmlChar*)"off" );
                        
			SYSLOG_DEBUG( "xmlconfig_load_timer: Name=%s Id=%s ON=%s, OFF=%s",
                                     tname, nodeid, on, off );
                }
		if ( (XML_READER_TYPE_END_ELEMENT == xmlTextReaderNodeType( reader )) &&
			(0 == xmlStrncmp(name, (const xmlChar *)"TimerConfig", 11)))
			break;

		ret = xmlTextReaderRead( reader );
	}
	return ret;
}
开发者ID:pmnair,项目名称:zwave-remote,代码行数:29,代码来源:xmlconfig.c

示例12: xmlTextReaderNodeType

const char *oscap_element_string_get(xmlTextReaderPtr reader)
{
	if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT ||
			xmlTextReaderNodeType(reader) == XML_READER_TYPE_ATTRIBUTE)
		xmlTextReaderRead(reader);
	if (xmlTextReaderHasValue(reader))
		return (const char *)xmlTextReaderConstValue(reader);
	return NULL;
}
开发者ID:galaris,项目名称:openscap,代码行数:9,代码来源:elements.c

示例13: processNode

/**
 * processNode:
 * @reader: the xmlReader
 *
 * Dump information about the current node
 */
static void processNode(xmlTextReaderPtr reader)
{
	int depth, type;

	type = xmlTextReaderNodeType(reader);
	if ((type == XML_ELEMENT_DECL) || (type == XML_DTD_NODE))
		return;

	depth = xmlTextReaderDepth(reader);

	if ((type == XML_ELEMENT_NODE) && (depth == 2))
		printf("\n");

	if (2 == depth)
		printf("\t");
	else if (3 == depth)
		printf("\t\t");

	xmlNodePtr node = xmlTextReaderCurrentNode(reader);
	if (xmlTextReaderNodeType(reader) == XML_ELEMENT_NODE && node && node->properties) {
		xmlAttr *attribute = node->properties;
		while (attribute && attribute->name && attribute->children) {
			tag = xmlNodeListGetString(node->doc, attribute->children, 1);
			printf ("%s%c", tag, (depth == 2) ? '\n' : ':');

			bdaddr = strtoba((const char *)tag);
			if (bdaddr)
				add_remote_device(bdaddr);

			attribute = attribute->next;
			/* tag name is what we need */
			break;
		}
	}

	if (xmlTextReaderNodeType(reader) == XML_TEXT_NODE) {
		if (xmlStrstr((xmlChar *)"Service", tag))
			parse_services(reader);
		else if (xmlStrstr((xmlChar *)"HidDescriptor", tag))
			parse_hid_descriptor(reader);
		else if (xmlStrstr((xmlChar *)"HogpRpt", tag))
			parse_hogp(reader);
		else if (xmlStrstr((xmlChar *)"GattAttrs", tag))
			parse_gatt_attribute(reader);
		else if (xmlStrstr((xmlChar *)"DevClass", tag))
			parse_dev_class(reader);
		else if (xmlStrstr((xmlChar *)"Timestamp", tag))
			parse_timestamp(reader);
		else if (xmlStrstr((xmlChar *)"Address", tag))
			parse_bdaddr(reader);
		else
			parse_text_node(reader);
	}
}
开发者ID:feedcafe,项目名称:droidparser,代码行数:60,代码来源:droidparser.c

示例14: scan

/*
  xar_process_subdocument - check TOC for xml subdocument. If found, extract and
                            scan in memory.
  Parameters:
     reader - xmlTextReaderPtr
     ctx - pointer to cli_ctx
  Returns:
     CL_SUCCESS - subdoc found and clean scan (or virus found and SCAN_ALL), or no subdocument
     other - error return code from cli_mem_scandesc()
*/
static int xar_scan_subdocuments(xmlTextReaderPtr reader, cli_ctx *ctx)
{
    int rc = CL_SUCCESS, subdoc_len, fd;
    xmlChar * subdoc;
    const xmlChar *name;
    char * tmpname;

    while (xmlTextReaderRead(reader) == 1) {
        name = xmlTextReaderConstLocalName(reader);
        if (name == NULL) {
            cli_dbgmsg("cli_scanxar: xmlTextReaderConstLocalName() no name.\n");
            rc = CL_EFORMAT;
            break;
        }
        if (xmlStrEqual(name, (const xmlChar *)"toc") &&
                xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT)
            return CL_SUCCESS;
        if (xmlStrEqual(name, (const xmlChar *)"subdoc") &&
                xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT) {
            subdoc = xmlTextReaderReadInnerXml(reader);
            if (subdoc == NULL) {
                cli_dbgmsg("cli_scanxar: no content in subdoc element.\n");
                xmlTextReaderNext(reader);
                continue;
            }
            subdoc_len = xmlStrlen(subdoc);
            cli_dbgmsg("cli_scanxar: in-memory scan of xml subdocument, len %i.\n", subdoc_len);
            rc = cli_mem_scandesc(subdoc, subdoc_len, ctx);
            if (rc == CL_VIRUS && SCAN_ALL)
                rc = CL_SUCCESS;

            /* make a file to leave if --leave-temps in effect */
            if(ctx->engine->keeptmp) {
                if ((rc = cli_gentempfd(ctx->engine->tmpdir, &tmpname, &fd)) != CL_SUCCESS) {
                    cli_dbgmsg("cli_scanxar: Can't create temporary file for subdocument.\n");
                } else {
                    cli_dbgmsg("cli_scanxar: Writing subdoc to temp file %s.\n", tmpname);
                    if (cli_writen(fd, subdoc, subdoc_len) < 0) {
                        cli_dbgmsg("cli_scanxar: cli_writen error writing subdoc temporary file.\n");
                        rc = CL_EWRITE;
                    }
                    rc = xar_cleanup_temp_file(ctx, fd, tmpname);
                }
            }

            xmlFree(subdoc);
            if (rc != CL_SUCCESS)
                return rc;
            xmlTextReaderNext(reader);
        }
    }
    return rc;
}
开发者ID:nayden,项目名称:clamav-devel,代码行数:63,代码来源:xar.c

示例15: cxHashRootLoadWithReader

cxBool cxHashRootLoadWithReader(cxHashRoot root,xmlTextReaderPtr reader)
{
    cxBool ret = false;
    while(xmlTextReaderRead(reader)){
        if(root->isError){
            break;
        }
        if(xmlTextReaderNodeType(reader) != XML_READER_TYPE_ELEMENT){
            continue;
        }
        cxConstChars temp = cxXMLReadElementName(reader);
        if(ELEMENT_IS_TYPE(cxHashRoot)){
            ret = true;
            break;
        }
    }
    CX_RETURN(!ret,false);
    cxAutoPoolPush();
    while(xmlTextReaderRead(reader)){
        if(xmlTextReaderNodeType(reader) != XML_READER_TYPE_ELEMENT){
            continue;
        }
        cxConstChars temp = cxXMLReadElementName(reader);
        if(ELEMENT_IS_TYPE(cxDBEnv)){
            cxHashRootReadDBEnv(root,reader);
            continue;
        }
        cxConstChars  sid = cxXMLAttr(reader, "id");
        if(sid == NULL){
            CX_WARN("element %s:not set id,data not save to hash table",temp);
            continue;
        }
        cxAny object = NULL;
        if(ELEMENT_IS_TYPE(cxString)){
            //cxTypesString
            object = cxHashRootReadString(root,reader);
        }else if(ELEMENT_IS_TYPE(cxHash)){
            //cxTypesHash
            object = cxHashRootReadHash(root,reader);
        }else if(ELEMENT_IS_TYPE(cxArray)){
            //cxTypesArray
            object = cxHashRootReadArray(root,reader);
        }else{
            //cxTypesNumber
            object = cxHashRootReadNumber(root, temp, reader);
        }
        if(object != NULL){
            cxHashSet(root->items, cxHashStrKey(sid), object);
        }
    }
    cxAutoPoolPop();
    return ret;
}
开发者ID:iloveican,项目名称:cxEngine,代码行数:53,代码来源:cxHashRoot.c


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