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


C++ xmlTextReaderGetAttribute函数代码示例

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


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

示例1: read_iso_3166_entry

static void
read_iso_3166_entry (xmlTextReaderPtr reader,
                     GHashTable *table)
{
    xmlChar *code, *name;

    code = xmlTextReaderGetAttribute (reader, (const xmlChar *) "alpha_2_code");
    name = xmlTextReaderGetAttribute (reader, (const xmlChar *) "name");

    if (code != NULL && code[0] != '\0' && name != NULL && name[0] != '\0')
    {
        char *lcode;

        lcode = g_ascii_strdown ((char *) code, -1);
        xmlFree (code);

        g_hash_table_insert (table, lcode, name);
    }
    else
    {
        xmlFree (code);
        xmlFree (name);
    }

}
开发者ID:TingPing,项目名称:hexchat,代码行数:25,代码来源:sexy-iso-codes.c

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

示例3: read_iso_639_entry

static void
read_iso_639_entry (xmlTextReaderPtr reader,
                    GHashTable *table)
{
    xmlChar *code, *name;

    code = xmlTextReaderGetAttribute (reader, (const xmlChar *) "iso_639_1_code");
    name = xmlTextReaderGetAttribute (reader, (const xmlChar *) "name");

    /* Get iso-639-2 code */
    if (code == NULL || code[0] == '\0')
    {
        xmlFree (code);
        /* FIXME: use the 2T or 2B code? */
        code = xmlTextReaderGetAttribute (reader, (const xmlChar *) "iso_639_2T_code");
    }

    if (code != NULL && code[0] != '\0' && name != NULL && name[0] != '\0')
    {
        g_hash_table_insert (table, code, name);
    }
    else
    {
        xmlFree (code);
        xmlFree (name);
    }
}
开发者ID:TingPing,项目名称:hexchat,代码行数:27,代码来源:sexy-iso-codes.c

示例4: _oval_test_parse_tag

static int _oval_test_parse_tag(xmlTextReaderPtr reader, struct oval_parser_context *context, void *user)
{
	struct oval_test *test = (struct oval_test *)user;
	char *tagname = (char *)xmlTextReaderLocalName(reader);
	int return_code = 0;
	if ((strcmp(tagname, "notes") == 0)) {
		return_code = oval_parser_parse_tag(reader, context, &_oval_test_parse_notes, test);
	} else if ((strcmp(tagname, "object") == 0)) {
		char *object_ref = (char *)xmlTextReaderGetAttribute(reader, BAD_CAST "object_ref");
		if (object_ref != NULL) {
			struct oval_definition_model *model = context->definition_model;
			struct oval_object *object = oval_definition_model_get_new_object(model, object_ref);
			oscap_free(object_ref);
			object_ref = NULL;
			oval_test_set_object(test, object);
		}
	} else if ((strcmp(tagname, "state") == 0)) {
		char *state_ref = (char *)xmlTextReaderGetAttribute(reader, BAD_CAST "state_ref");
		if (state_ref != NULL) {
			struct oval_definition_model *model = context->definition_model;
			struct oval_state *state = oval_definition_model_get_new_state(model, state_ref);
			oval_test_add_state(test, state);
			oscap_free(state_ref);
			state_ref = NULL;
		}
	} else {
		oscap_dlprintf(DBG_W, "Skipping tag <%s>.\n", tagname);
		return_code = oval_parser_skip_tag(reader, context);
	}

	oscap_free(tagname);
	return return_code;

}
开发者ID:GovReady,项目名称:openscap,代码行数:34,代码来源:oval_test.c

示例5: parse_tileset

static int parse_tileset(xmlTextReaderPtr reader, tmx_tileset **ts_headadr, const char *filename) {
	tmx_tileset *res = NULL;
	int ret;
	char *value, *ab_path;
	xmlTextReaderPtr sub_reader;
	
	if (!(res = alloc_tileset())) return 0;
	res->next = *ts_headadr;
	*ts_headadr = res;
	
	/* parses each attribute */
	if ((value = (char*)xmlTextReaderGetAttribute(reader, (xmlChar*)"firstgid"))) { /* fisrtgid */
		res->firstgid = atoi(value);
		tmx_free_func(value);
	} else {
		tmx_err(E_MISSEL, "xml parser: missing 'firstgid' attribute in the 'tileset' element");
		return 0;
	}
	
	if ((value = (char*)xmlTextReaderGetAttribute(reader, (xmlChar*)"source"))) { /* source */
		if (!(ab_path = mk_absolute_path(filename, value))) return 0;
		tmx_free_func(value);
		if (!(sub_reader = create_parser(ab_path))) return 0; /* opens */
		ret = parse_tileset_sub(sub_reader, res, ab_path); /* and parses the tsx file */
		xmlFreeTextReader(sub_reader);
		tmx_free_func(ab_path);
		return ret;
	}
	
	return parse_tileset_sub(reader, res, filename);
}
开发者ID:NickLawsonDev,项目名称:Allegro5,代码行数:31,代码来源:tmx_xml.c

示例6: TestExample

static bool TestExample(xmlTextReaderPtr reader, procdraw::LispInterpreter *L, int *numTests)
{
    bool testPassed = false;

    xmlChar *expr = xmlTextReaderGetAttribute(reader, BAD_CAST "expr");
    if (expr != NULL) {
        xmlChar *expectedValue = xmlTextReaderGetAttribute(reader, BAD_CAST "value");
        if (expectedValue != NULL) {
            std::string result = L->PrintToString(L->Eval(L->Read(reinterpret_cast<char*>(expr))));
            *numTests = *numTests + 1;
            if (xmlStrEqual(expectedValue, BAD_CAST result.c_str())) {
                testPassed = true;
            }
            else {
                testPassed = false;
                std::cerr << "EXPR: " << expr;
                std::cerr << " EXPECTED: " << expectedValue;
                std::cerr << " ACTUAL: " << result << std::endl;
            }
            xmlFree(expectedValue);
        }
        xmlFree(expr);
    }

    return testPassed;
}
开发者ID:kikidesign,项目名称:procdraw,代码行数:26,代码来源:test_function_spec.cpp

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

示例8: EPUB3ProcessXMLReaderNodeForManifestInOPF

EPUB3Error EPUB3ProcessXMLReaderNodeForManifestInOPF(EPUB3Ref epub, xmlTextReaderPtr reader, EPUB3XMLParseContextPtr *context)
{
  assert(epub != NULL);
  assert(reader != NULL);

  EPUB3Error error = kEPUB3Success;
  const xmlChar *name = xmlTextReaderConstLocalName(reader);
  xmlReaderTypes nodeType = xmlTextReaderNodeType(reader);

  switch(nodeType)
  {
    case XML_READER_TYPE_ELEMENT:
    {
      if(!xmlTextReaderIsEmptyElement(reader)) {
        (void)EPUB3SaveParseContext(context, kEPUB3OPFStateManifest, name, 0, NULL, kEPUB3_YES, NULL);
      } else {
        if(xmlStrcmp(name, BAD_CAST "item") == 0) {
          EPUB3ManifestItemRef newItem = EPUB3ManifestItemCreate();
          newItem->itemId = (char *)xmlTextReaderGetAttribute(reader, BAD_CAST "id");
          newItem->href = (char *)xmlTextReaderGetAttribute(reader, BAD_CAST "href");
          newItem->mediaType = (char *)xmlTextReaderGetAttribute(reader, BAD_CAST "media-type");
          newItem->properties = (char *)xmlTextReaderGetAttribute(reader, BAD_CAST "properties");

          if(newItem->properties != NULL) {
            // Look for the cover-image property
            char *prop, *props, *tofree;
            tofree = props = strdup(newItem->properties);
            while((prop = strsep(&props, " ")) != NULL) {
              if(strcmp(prop, "cover-image") == 0) {
                EPUB3MetadataSetCoverImageId(epub->metadata, newItem->itemId);
              }
            }
            EPUB3_FREE_AND_NULL(tofree);
          }
          if(newItem->mediaType != NULL && strcmp(newItem->mediaType, "application/x-dtbncx+xml") == 0) {
            //This is the ref for the ncx document. Set it for v2 epubs
            //if(epub->metadata->version == kEPUB3Version_2) {
              EPUB3MetadataSetNCXItem(epub->metadata, newItem);
            //}
          }
          EPUB3ManifestInsertItem(epub->manifest, newItem);
        }
      }
      break;
    }
    case XML_READER_TYPE_TEXT:
    {
      break;
    }
    case XML_READER_TYPE_END_ELEMENT:
    {
      (void)EPUB3PopAndFreeParseContext(context);
      break;
    }
    default: break;
  }
  return error;
}
开发者ID:UIKit0,项目名称:EPUB3Processor,代码行数:58,代码来源:EPUB3.c

示例9: oval_test_parse_tag

int oval_test_parse_tag(xmlTextReaderPtr reader, struct oval_parser_context *context, void *usr)
{
	int ret = 0;
	char *comm = NULL;
	char *version = NULL;
	struct oval_definition_model *model = context->definition_model;

	char *id = (char *)xmlTextReaderGetAttribute(reader, BAD_CAST "id");
	struct oval_test *test = oval_definition_model_get_new_test(model, id);

	oval_subtype_t subtype = oval_subtype_parse(reader);
        if ( subtype == OVAL_SUBTYPE_UNKNOWN) {
		oscap_seterr(OSCAP_EFAMILY_OVAL, "Unknown test type %s.", id);
		ret = -1;
		goto cleanup;
        }
	oval_test_set_subtype(test, subtype);

	oval_operator_t ste_operator = oval_operator_parse(reader, "state_operator", OVAL_OPERATOR_AND);
	oval_test_set_state_operator(test, ste_operator);

	oval_check_t check = oval_check_parse(reader, "check", OVAL_CHECK_UNKNOWN);
	if (check == OVAL_CHECK_NONE_EXIST) {
		dW("The 'none exist' CheckEnumeration value has been deprecated. "
		   "Converted to check='none satisfy' and check_existence='none exist'.\n");
		oval_test_set_check(test, OVAL_CHECK_NONE_SATISFY);
		oval_test_set_existence(test, OVAL_NONE_EXIST);
	} else {
		oval_existence_t existence;

		oval_test_set_check(test, check);
		existence = oval_existence_parse(reader, "check_existence", OVAL_AT_LEAST_ONE_EXISTS);
		oval_test_set_existence(test, existence);
	}

	comm = (char *)xmlTextReaderGetAttribute(reader, BAD_CAST "comment");
	if (comm != NULL) {
		oval_test_set_comment(test, comm);
	}

	int deprecated = oval_parser_boolean_attribute(reader, "deprecated", 0);
	oval_test_set_deprecated(test, deprecated);

	version = (char *)xmlTextReaderGetAttribute(reader, BAD_CAST "version");
	oval_test_set_version(test, atoi(version));


	ret = oval_parser_parse_tag(reader, context, &_oval_test_parse_tag, test);

cleanup:
	oscap_free(version);
	oscap_free(comm);
	oscap_free(id);
	return ret;
}
开发者ID:GovReady,项目名称:openscap,代码行数:55,代码来源:oval_test.c

示例10: EPUB3ProcessXMLReaderNodeForSpineInOPF

EPUB3Error EPUB3ProcessXMLReaderNodeForSpineInOPF(EPUB3Ref epub, xmlTextReaderPtr reader, EPUB3XMLParseContextPtr *context)
{
  assert(epub != NULL);
  assert(reader != NULL);

  EPUB3Error error = kEPUB3Success;
  const xmlChar *name = xmlTextReaderConstLocalName(reader);
  xmlReaderTypes nodeType = xmlTextReaderNodeType(reader);

  switch(nodeType)
  {
    case XML_READER_TYPE_ELEMENT:
    {
      if(!xmlTextReaderIsEmptyElement(reader)) {
        (void)EPUB3SaveParseContext(context, kEPUB3OPFStateManifest, name, 0, NULL, kEPUB3_YES, NULL);
      } else {
        if(xmlStrcmp(name, BAD_CAST "itemref") == 0) {
          EPUB3SpineItemRef newItem = EPUB3SpineItemCreate();
          xmlChar * linear = xmlTextReaderGetAttribute(reader, BAD_CAST "linear");

          if(linear == NULL || xmlStrcmp(linear, BAD_CAST "yes") == 0) {
            newItem->isLinear = kEPUB3_YES;
            epub->spine->linearItemCount++;
          }
          EPUB3_XML_FREE_AND_NULL(linear);
          newItem->idref = (char *)xmlTextReaderGetAttribute(reader, BAD_CAST "idref");
          if(newItem->idref != NULL) {
            EPUB3ManifestItemListItemPtr manifestPtr = EPUB3ManifestFindItemWithId(epub->manifest, newItem->idref);
            if(manifestPtr == NULL) {
              newItem->manifestItem = NULL;
            } else {
              newItem->manifestItem = manifestPtr->item;
            }
          }
          EPUB3SpineAppendItem(epub->spine, newItem);
        }
      }
      break;
    }
    case XML_READER_TYPE_TEXT:
    {
      break;
    }
    case XML_READER_TYPE_END_ELEMENT:
    {
      (void)EPUB3PopAndFreeParseContext(context);
      break;
    }
    default: break;
  }
  return error;
}
开发者ID:UIKit0,项目名称:EPUB3Processor,代码行数:52,代码来源:EPUB3.c

示例11: xmlTextReaderDepth

ExtractionWay XMLParser::_ReadXMLWay() {
	ExtractionWay way;
	if ( xmlTextReaderIsEmptyElement( inputReader ) != 1 ) {
		const int depth = xmlTextReaderDepth( inputReader );
		while ( xmlTextReaderRead( inputReader ) == 1 ) {
			const int childType = xmlTextReaderNodeType( inputReader );
			if ( childType != 1 && childType != 15 ) {
				continue;
			}
			const int childDepth = xmlTextReaderDepth( inputReader );
			xmlChar* childName = xmlTextReaderName( inputReader );
			if ( childName == NULL ) {
				continue;
			}

			if ( depth == childDepth && childType == 15 && xmlStrEqual( childName, ( const xmlChar* ) "way" ) == 1 ) {
				xmlChar* id = xmlTextReaderGetAttribute( inputReader, ( const xmlChar* ) "id" );
				way.id = stringToUint((char*)id);
				xmlFree(id);
				xmlFree( childName );
				break;
			}
			if ( childType != 1 ) {
				xmlFree( childName );
				continue;
			}

			if ( xmlStrEqual( childName, ( const xmlChar* ) "tag" ) == 1 ) {
				xmlChar* k = xmlTextReaderGetAttribute( inputReader, ( const xmlChar* ) "k" );
				xmlChar* value = xmlTextReaderGetAttribute( inputReader, ( const xmlChar* ) "v" );
				//				cout << "->k=" << k << ", v=" << value << endl;
				if ( k != NULL && value != NULL ) {
					way.keyVals.Add(std::string( (char *) k ), std::string( (char *) value));
				}
				if ( k != NULL ) {
					xmlFree( k );
				}
				if ( value != NULL ) {
					xmlFree( value );
				}
			} else if ( xmlStrEqual( childName, ( const xmlChar* ) "nd" ) == 1 ) {
				xmlChar* ref = xmlTextReaderGetAttribute( inputReader, ( const xmlChar* ) "ref" );
				if ( ref != NULL ) {
					way.path.push_back( stringToUint(( const char* ) ref ) );
					xmlFree( ref );
				}
			}
			xmlFree( childName );
		}
	}
	return way;
}
开发者ID:DanielTripp,项目名称:Project-OSRM,代码行数:52,代码来源:XMLParser.cpp

示例12: parse_classes

static GSList *
parse_classes (ParserState *parser_state)
{
	GSList *ret = NULL;
	xmlChar *en = xmlTextReaderGetAttribute (parser_state->reader, BAD_CAST "class");
	xmlChar *dis = xmlTextReaderGetAttribute (parser_state->reader, BAD_CAST "class-disabled");

	ret = add_classes (ret, (gchar const *)en, TRUE);
	ret = add_classes (ret, (gchar const *)dis, FALSE);

	xmlFree (en);
	xmlFree (dis);

	return ret;
}
开发者ID:anduchs,项目名称:gtksourceview-headlining,代码行数:15,代码来源:gtksourcelanguage-parser-2.c

示例13: xmlTextReaderGetAttribute

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

示例14: XmlReader_getAttribute

//## @Native String XmlReader.getAttribute();
static KMETHOD XmlReader_getAttribute(KonohaContext *kctx, KonohaStack *sfp)
{
	xmlTextReaderPtr reader = getRawXmlReader(sfp[0]);
	xmlChar* ns = (xmlChar *)kString_text(sfp[1].asString);
	char* ret = (reader != NULL) ? (char *) xmlTextReaderGetAttribute(reader,ns) : NULL;
	KReturn(KLIB new_kString(kctx, GcUnsafe, ret, strlen(ret), 0));
}
开发者ID:Kouhei-Moriya,项目名称:konoha3,代码行数:8,代码来源:xml_glue.c

示例15: reader_attribute

/*
 * call-seq:
 *   attribute(name)
 *
 * Get the value of attribute named +name+
 */
static VALUE reader_attribute(VALUE self, VALUE name)
{
  xmlTextReaderPtr reader;
  xmlChar *value ;
  Data_Get_Struct(self, xmlTextReader, reader);

  if(name == Qnil) return Qnil;
  name = StringValue(name) ;

  value = xmlTextReaderGetAttribute(reader, (xmlChar*)StringValuePtr(name));
  if(value == NULL) {
    /* this section is an attempt to workaround older versions of libxml that
       don't handle namespaces properly in all attribute-and-friends functions */
    xmlChar *prefix = NULL ;
    xmlChar *localname = xmlSplitQName2((xmlChar*)StringValuePtr(name), &prefix);
    if (localname != NULL) {
      value = xmlTextReaderLookupNamespace(reader, localname);
      xmlFree(localname) ;
    } else {
      value = xmlTextReaderLookupNamespace(reader, prefix);
    }
    xmlFree(prefix);
  }
  if(value == NULL) return Qnil;

  VALUE MAYBE_UNUSED(enc) = rb_iv_get(self, "@encoding");
  VALUE rb_value = NOKOGIRI_STR_NEW2(value,
      RTEST(enc) ? StringValuePtr(enc) : NULL);
  xmlFree(value);
  return rb_value;
}
开发者ID:halorgium,项目名称:nokogiri,代码行数:37,代码来源:xml_reader.c


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