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


C++ xmlTextReaderName函数代码示例

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


在下文中一共展示了xmlTextReaderName函数的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: _exml_read

static int _exml_read(EXML *xml, xmlTextReaderPtr reader)
{
	int empty;
	xmlChar *name, *value;

	if (!reader)
		return -1;

	exml_clear( xml );

	while( xmlTextReaderRead( reader ) == 1 ) {
		name = xmlTextReaderName(reader);
		value = xmlTextReaderValue(reader);
		empty = xmlTextReaderIsEmptyElement(reader);

		switch( xmlTextReaderNodeType(reader) ) {
			case XML_READER_TYPE_ELEMENT:
				exml_start(xml);
				exml_tag_set(xml, (char *) name);
		
				if (xmlTextReaderHasAttributes(reader)) {
					xmlTextReaderMoveToFirstAttribute(reader);
					do {
						xmlChar *attr_name, *attr_value;

						attr_name = xmlTextReaderName(reader);
						attr_value = xmlTextReaderValue(reader);

						exml_attribute_set(xml, (char *) attr_name, (char *) attr_value);

						xmlFree(attr_name);
						xmlFree(attr_value);
					} while( xmlTextReaderMoveToNextAttribute(reader) == 1 );
				}

				if (!empty)
					break;
			case XML_READER_TYPE_END_ELEMENT:
				exml_end(xml);
				break;
			case XML_READER_TYPE_WHITESPACE:
				break;
			case XML_READER_TYPE_TEXT:
				exml_value_set(xml, (char *) value);
				break;
		}
		xmlFree(name);
		xmlFree(value);
	}

	xmlTextReaderClose(reader);
	xmlFreeTextReader(reader);

	exml_goto_top( xml );

	return TRUE;
}
开发者ID:playya,项目名称:Enlightenment,代码行数:57,代码来源:exml.c

示例3: main

int main (void)
{
  xmlTextReaderPtr xml = xmlReaderForFd (STDIN_FILENO, "", NULL, 0);
  while (xmlTextReaderRead (xml)) {
    char *name = (char *) BAD_CAST xmlTextReaderName (xml);
    if (xmlTextReaderNodeType (xml) == XML_READER_TYPE_ELEMENT &&
         strcasecmp (name, "text") == 0) {
      while (xmlTextReaderRead (xml) && // memory leak :
              xmlStrcmp (xmlTextReaderName (xml), BAD_CAST "#text") != 0) {}
      printf ("%s\n", xmlTextReaderValue (xml));
    }
  }
}
开发者ID:Urucas,项目名称:gosmore,代码行数:13,代码来源:extract.c

示例4: getXmlReader

void Table::RTTraiteTuple(int & etat, SetOfInt & tmpSetOfInt)
{
  // on recupere le reader
  xmlTextReaderPtr reader = getXmlReader();

  if ((xmlTextReaderNodeType(reader) == baliseOuvrante) && (xmlStrcmp(xmlTextReaderName(reader), xmlCharStrdup("Item")) == 0))
    etat = RTItem;

  if ((xmlTextReaderNodeType(reader) == baliseFermante) && (xmlStrcmp(xmlTextReaderName(reader), xmlCharStrdup("Tuple")) == 0))
    etat = RTFin;

  // on réinitialise le reader
  setXmlReader(reader);
}
开发者ID:BackupTheBerlios,项目名称:micromegas-svn,代码行数:14,代码来源:table.cpp

示例5: TileMap_parse_map

TileMapParseStatus TileMap_parse_map(xmlTextReaderPtr reader, Engine *engine,
                                     TileMap *map) {
  TileMapParseStatus status = TILEMAP_PARSE_OK;
  
  xmlChar *name = xmlTextReaderName(reader);
  if (!(streq(name, "map") &&
        xmlTextReaderNodeType(reader) == XML_ELEMENT_NODE)) {
    return TILEMAP_PARSE_INVALID_FORMAT;
  }
  
  while (xmlTextReaderMoveToNextAttribute(reader)) {
    xmlChar *attrName = xmlTextReaderName(reader);
    xmlChar *attrVal = xmlTextReaderValue(reader);
    
    if (streq(attrName, "orientation")) {
      if (!streq(attrVal, "orthogonal")) {
        return TILEMAP_PARSE_INVALID_ORIENTATION;
      }
    } else if (streq(attrName, "width")) {
      map->cols = atoi((const char *)attrVal);
    } else if (streq(attrName, "height")) {
      map->rows = atoi((const char *)attrVal);
    } else if (streq(attrName, "tilewidth")) {
      map->tile_size.w = atoi((const char *)attrVal);
    } else if (streq(attrName, "tileheight")) {
      map->tile_size.h = atoi((const char *)attrVal);
    }
  }
  
  while (xmlTextReaderRead(reader)) {
    xmlChar *childName = xmlTextReaderName(reader);
    if (xmlTextReaderNodeType(reader) == XML_ELEMENT_DECL &&
        streq(childName, "map")) {
      break;
    } else if (streq(childName, "tileset")) {
      Tileset *tileset = NULL;
      status = TileMap_parse_tileset(reader, engine, map, &tileset);
      if (status != TILEMAP_PARSE_OK) return status;
      DArray_push(map->tilesets, tileset);
    } else if (streq(childName, "layer")) {
      TileMapLayer *layer = NULL;
      status = TileMap_parse_layer(reader, map, &layer);
      if (status != TILEMAP_PARSE_OK) return status;
      DArray_push(map->layers, layer);
    }
  }
  
  return status;
}
开发者ID:mdegs,项目名称:dabes_engine,代码行数:49,代码来源:tile_map_parse.c

示例6: ows_parse_config_pg

/*
 * Parse the configuration file's pg element about connection information
 */
static void ows_parse_config_pg(ows * o, xmlTextReaderPtr r)
{
    xmlChar *a, *v;

    assert(o);
    assert(r);

    if (xmlTextReaderMoveToFirstAttribute(r) != 1) return;
    do {
        a = xmlTextReaderName(r);

        if (       !strcmp((char *) a, "host")
                || !strcmp((char *) a, "user")
                || !strcmp((char *) a, "password")
                || !strcmp((char *) a, "dbname")
                || !strcmp((char *) a, "port")) {
            v = xmlTextReaderValue(r);
            buffer_add_str(o->pg_dsn, (char *) a);
            buffer_add_str(o->pg_dsn, "=");
            buffer_add_str(o->pg_dsn, (char *) v);
            buffer_add_str(o->pg_dsn, " ");
            xmlFree(v);
        } else if (!strcmp((char *) a, "encoding")) { 
            v = xmlTextReaderValue(r); 
            buffer_add_str(o->db_encoding, (char *) v); 
            xmlFree(v); 
        }

        xmlFree(a);
    } while (xmlTextReaderMoveToNextAttribute(r) == 1);

    if (!o->db_encoding->use)
        buffer_add_str(o->db_encoding, OWS_DEFAULT_DB_ENCODING);
}
开发者ID:sdikiy,项目名称:tinyows,代码行数:37,代码来源:ows_config.c

示例7: processNode

void	processNode( xmlTextReaderPtr reader, node *nodeTable) {
			int	index ;
	const xmlChar *name, *value;

	name = xmlTextReaderConstName(reader);
	if (name == NULL)
	name = BAD_CAST "--";

	index	=	0 ;
        while ( xmlTextReaderRead( reader) == 1) {
		switch ( xmlTextReaderNodeType(reader)) {
		case	XML_READER_TYPE_ELEMENT	:
			if ( strcmp((char *) xmlTextReaderName( reader), "groupobject") == 0) {
				strcpy( nodeTable[index].name, (char *) xmlTextReaderGetAttribute( reader, (xmlChar *) "name")) ;
				strcpy( nodeTable[index].alias, (char *) xmlTextReaderGetAttribute( reader, (xmlChar *) "alias")) ;
				nodeTable[index].knxGroupAddr	=	atoi( (char *) xmlTextReaderGetAttribute( reader, (xmlChar *) "knxGroupAddr")) ;
				nodeTable[index].type	=	lookupDPT( (char *) xmlTextReaderGetAttribute( reader, (xmlChar *) "dpt")) ;
//				printf( "Element node\n") ;
//				printf( "  Id............: %s \n", (char *) xmlTextReaderGetAttribute( reader, (xmlChar *) "id")) ;
//				printf( "  Name..........: '%s' \n", (char *) xmlTextReaderGetAttribute( reader, (xmlChar *) "name")) ;
//				printf( "  DPT...........: %s(%d) \n", (char *) xmlTextReaderGetAttribute( reader, (xmlChar *) "dpt"), nodeTable[index].type) ;
//				printf( "  Group addr....: %s \n", (char *) xmlTextReaderGetAttribute( reader, (xmlChar *) "groupAddr")) ;
//				printf( "  Trigger only..: %s \n", (char *) xmlTextReaderGetAttribute( reader, (xmlChar *) "trigger")) ;
				index++ ;
			}
			break ;
		}
	}
}
开发者ID:ianhom,项目名称:knxR2,代码行数:29,代码来源:myxml.c

示例8: processNode

	/**
	 * Callback for XML-Node processing
	**/
	void processNode(xmlTextReaderPtr reader, char *objPath, ruleExecInfo_t* rei) {
		xmlChar *name, *value;
		
		rodsLog( LOG_NOTICE, "Calling processNode()\n");

		name = xmlTextReaderName(reader);
		value = xmlTextReaderValue(reader);

		if (xmlStrEqual(name, BAD_CAST "spectrumList")) {
			end = 1;
		}
		
		else if (xmlStrEqual(name, BAD_CAST "cvParam")) {
			if(xmlTextReaderHasAttributes(reader) > 0) {
				rodsLog(LOG_NOTICE, "Extracting cvParam information...\n");
			
				xmlChar *cvLabel = xmlTextReaderGetAttribute(reader, (xmlChar *) "cvLabel");
				xmlChar *cvAccession = xmlTextReaderGetAttribute(reader, (xmlChar *) "accession");
				xmlChar *cvName = xmlTextReaderGetAttribute(reader, (xmlChar *) "name");
				xmlChar *cvValue = xmlTextReaderGetAttribute(reader, (xmlChar *) "name");
				printf("cvParam: [%s] [%s] [%s] [%s]\n", cvLabel, cvAccession, cvName, cvValue);
				
				createMetadataOnObject(objPath, (char*) "cvParam", (char *) cvLabel, (char*) "", rei);
				createMetadataOnObject(objPath, (char *) cvLabel, (char *) cvValue, (char *) cvAccession, rei);
				createMetadataOnObject(objPath, (char *) cvLabel, (char *) cvName, (char*) "", rei);
			}
		}
		
	}
开发者ID:Metalnx,项目名称:metalnx-msi,代码行数:32,代码来源:libmsiobjput_mdmanifest.cpp

示例9: xmlTextReaderName

string BEXMLTextReader::name()
{
	const xmlChar * node_name = xmlTextReaderName ( reader );
	string name = (const char *)node_name;
	xmlFree ( (xmlChar *)node_name );
	return name;
}
开发者ID:SeAlgoAsoma,项目名称:BaseElements-Plugin,代码行数:7,代码来源:BEXMLTextReader.cpp

示例10: 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

示例11: getNextNode

std :: string getNextNode ()
{

  xmlChar * name, * value;

  do
    {
      xmlTextReaderRead (reader);
      name = xmlTextReaderName (reader);
      value = xmlTextReaderValue (reader);
    }
  while (! strcmp ((char *) name, "#text") && isSep (value));

  std :: string str;

  if (strcmp ((char *) name, "#text"))
    str.assign ((char *) name);
  else
    str.assign ((char *) value);

  if (name)
    xmlFree (name);
  if (value)
    xmlFree (value);

  return str;
}
开发者ID:hunanhd,项目名称:vns,代码行数:27,代码来源:xml_parser.cpp

示例12: expect_element_end

static int expect_element_end (
    xmlTextReaderPtr reader,
    char *exp_name)
{
    xmlChar *name;
    /* maybe we are already on the end element ... lets see */
    if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_END_ELEMENT){
         xmlChar *temp;
         xmlChar *temp2;            
         temp = xmlTextReaderName(reader);
         temp2 = (xmlChar*)sprintf_alloc("/%s", temp);
         name = xmlStrdup(temp2);
         xmlFree(temp);
         free(temp2);            
    } else {     
         name = get_xml_element(reader);
    }

    if (name == NULL)
        return -1;    
    if (xmlStrcasecmp(name+1,(xmlChar *)exp_name) != 0 || name[0] != '/'){
        rrd_set_error("line %d: expected </%s> end element but found <%s>",
                      xmlTextReaderGetParserLineNumber(reader),exp_name,name);
        xmlFree(name);            
        return -1;            
    }
    xmlFree(name);    
    return 0;    
} /* expect_element_end */
开发者ID:DigiTempReader,项目名称:rrdtool-1.x,代码行数:29,代码来源:rrd_restore.c

示例13: getElementContent

char* getElementContent(MemoryStruct *xmlDoc, char *elementName)
{
    xmlTextReaderPtr reader;
    int ret;
    xmlChar *name, *value;

    reader = xmlReaderForMemory(xmlDoc->data, xmlDoc->size, "http://www.example.org/", NULL, 0);
    if (reader != NULL) {
        ret = xmlTextReaderRead(reader);
        while (ret == 1) {
            name = xmlTextReaderName(reader);
            if (strcmp(elementName, (char*) name) == 0 && xmlTextReaderNodeType(reader) == 1) {
                //printf("Name: %s\tType: %d\t", name, xmlTextReaderNodeType(reader));
                ret = xmlTextReaderRead(reader);
                if (ret == 1) {
                    value = xmlTextReaderValue(reader);
                    //printf("Value: %s\n", value);
                    //xmlFree(value);
                    xmlFree(name);
                    xmlFreeTextReader(reader);
                    return (char*) value;
                }
            }
            xmlFree(name);
            ret = xmlTextReaderRead(reader);
        }
        xmlFreeTextReader(reader);
        if (ret != 0) printf("Failed to parse.\n");
    }
    else printf("Unable to read XML from memory.\n");
    return;
}
开发者ID:damomeen,项目名称:ofagent-for-zyxel-FSG2200HNU,代码行数:32,代码来源:xml_sample3.c

示例14: parse_ac_fp

//Parse AC flight plan xml (block & waypoint names
void parse_ac_fp(int DevNameIndex, char *filename) {
  xmlTextReaderPtr reader;
  int ret;

  reader = xmlReaderForFile(filename, NULL, XML_PARSE_NOWARNING | XML_PARSE_NOERROR); /* Dont validate with the DTD */

  xmlChar *name, *value;
  if (reader != NULL) {
    ret = xmlTextReaderRead(reader);

    int wp_queue=1;
    int bl_queue=1;
    while (ret == 1) {
      name = xmlTextReaderName(reader);
      if (name == NULL) {
        name = xmlStrdup(BAD_CAST "--");
      }

      //read waypoint names
      if (xmlStrEqual(name, (const xmlChar *)"waypoint")) {
        //waypoint node read name attr.
        xmlTextReaderMoveToAttribute(reader,(const xmlChar *)"name");
        value = xmlTextReaderValue(reader);
        //copy it to DevNames[] structure
        strcpy(DevNames[DevNameIndex].AcWp[wp_queue].Wp_Name, (char *) value);
        wp_queue++;
      }

      if (xmlStrEqual(name, (const xmlChar *)"block")) {
        //Read block names
        if ( xmlTextReaderAttributeCount(reader) >= 1 ) {
          xmlTextReaderMoveToAttribute(reader,(const xmlChar *)"name");
          value = xmlTextReaderValue(reader);
          strcpy(DevNames[DevNameIndex].AcBl[bl_queue].Bl_Name, (char *) value);
          bl_queue++;
        }
      }

      ret = xmlTextReaderRead(reader);
    }

    xmlFreeTextReader(reader);
    if (ret != 0) {
      if (verbose) {
        printf("App Server: failed to parse %s\n", filename);
        fflush(stdout);
      }
    }
  }
  else
  {
    if (verbose) {
      printf("App Server: Unable to open %s\n", filename);
      fflush(stdout);
    }
  }

}
开发者ID:1bitsquared,项目名称:paparazzi,代码行数:59,代码来源:app_server.c

示例15: parse_ac_af

void parse_ac_af(int DevNameIndex, char *filename) {
  xmlTextReaderPtr reader;
  int ret;

  reader = xmlReaderForFile(filename, NULL, XML_PARSE_NOWARNING | XML_PARSE_NOERROR); /* Dont validate with the DTD */

  xmlChar *name, *value;
  if (reader != NULL) {
    ret = xmlTextReaderRead(reader);

    while (ret == 1) {
      name = xmlTextReaderName(reader);

      if (name == NULL) {
        name = xmlStrdup(BAD_CAST "--");
      }

      if (xmlStrEqual(name, (const xmlChar *)"firmware")) {
        xmlTextReaderMoveToAttribute(reader,(const xmlChar *)"name");
        value = xmlTextReaderValue(reader);
        //check if firmware name is accaptable
        if (check_firmware_type(value)>0) {
          strcpy(DevNames[DevNameIndex].type, (char *) value);
        }

      }

      if (xmlStrEqual(name, (const xmlChar *)"define")) {
        xmlTextReaderMoveToAttribute(reader,(const xmlChar *)"name");
        value = xmlTextReaderValue(reader);

        if (xmlStrEqual(value, (const xmlChar *)"AC_ICON")) {
          xmlTextReaderMoveToAttribute(reader,(const xmlChar *)"value");
          value = xmlTextReaderValue(reader);
          strcpy(DevNames[DevNameIndex].type, (char *) value);
          return;
        }
      }

      ret = xmlTextReaderRead(reader);
    }

    xmlFreeTextReader(reader);
    if (ret != 0) {
      if (verbose) {
        printf("App Server: failed to parse %s\n", filename);
        fflush(stdout);
      }
    }
  } else {
    if (verbose) {
      printf("App Server: Unable to open %s\n", filename);
      fflush(stdout);
    }
  }

}
开发者ID:1bitsquared,项目名称:paparazzi,代码行数:57,代码来源:app_server.c


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