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


C++ TiXmlNode::FirstChild方法代码示例

本文整理汇总了C++中TiXmlNode::FirstChild方法的典型用法代码示例。如果您正苦于以下问题:C++ TiXmlNode::FirstChild方法的具体用法?C++ TiXmlNode::FirstChild怎么用?C++ TiXmlNode::FirstChild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TiXmlNode的用法示例。


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

示例1: ParseArtistList

bool CLastFMDirectory::ParseArtistList(CStdString url, CFileItemList &items)
{
  if (!RetrieveList(url))
    return false;

  TiXmlElement* pRootElement = m_xmlDoc.RootElement();

  TiXmlElement* pEntry = pRootElement->FirstChildElement("artist");

  while(pEntry)
  {
    TiXmlNode* name = pEntry->FirstChild("name");
    TiXmlNode* count;
    const char *countstr = NULL;
    const char *namestr = NULL;

    count = pEntry->FirstChild("count");
    if (!count) count = pEntry->FirstChild("playcount");
    if (!count) count = pEntry->FirstChild("match");
    if (!count && pEntry->Attribute("count"))
      countstr = pEntry->Attribute("count");
    else
      countstr = count->FirstChild()->Value();
    if (name)
      namestr = name->FirstChild()->Value();
    else
      namestr = pEntry->Attribute("name");


    if (namestr)
      AddListEntry(namestr, NULL, countstr, NULL, NULL,
          "lastfm://xbmc/artist/" + (CStdString)namestr + "/", items);

    pEntry = pEntry->NextSiblingElement("artist");
  }

  m_xmlDoc.Clear();
  return true;
}
开发者ID:tmacreturns,项目名称:XBMC_wireless_setup,代码行数:39,代码来源:LastFMDirectory.cpp

示例2: load

	bool Overlay::load(std::string name)
	{
		std::string fullpath = Engine::get().getGameDirectory() + "/overlays/" + name;
		TiXmlDocument doc(fullpath.c_str());
		if(!doc.LoadFile())
		{
			std::cerr << "Could not find overlay file " << fullpath << std::endl;
			return false;
		}
		TiXmlNode *xmlroot;
		TiXmlNode *xmlnode;
		TiXmlElement *xmlelement;
		if((xmlroot = doc.FirstChild("overlay")))
		{
			std::cerr << "Could not find <overlay> in " << fullpath << std::endl;
			return false;
		}
		xmlelement = xmlroot->ToElement();
		if(!xmlelement->Attribute("name"))
		{
			std::cerr << "Could not find \"name\" for <overlay> in overlay file " << fullpath << std::endl;
			return false;
		}
		name = xmlelement->Attribute("name");
		
		// Parsing groups
		xmlnode = xmlroot->FirstChild("group");
		while(xmlnode)
		{
			if((xmlelement = xmlnode->ToElement()))
			{
				if(!xmlelement->Attribute("name"))
				{
					std::cerr << "Could not find \"name\" for <group> in overlay file " << fullpath << std::endl;
					return false;
				}
				// Instantiate new group
				groups[xmlelement->Attribute("name")] = new OverlayGroup;
				// Load group from node
				if(!groups[xmlelement->Attribute("name")]->load(xmlnode))
				{
					std::cout << "Error on loading overlay group from " << fullpath << std::endl;
					return false;
				}
			}

			xmlnode = xmlroot->IterateChildren("group", xmlnode);
		}
		
		return true;
	}
开发者ID:mgottschlag,项目名称:backlot-old,代码行数:51,代码来源:Overlay.cpp

示例3: LoadSounds

void zzzSndSystem::LoadSounds()
{
	//read xml & load sets
	DataStreamPtr data = ResourceGroupManager::getSingleton().openResource("sounds.xml");
	String str = data->getAsString();
	TiXmlDocument doc;
	doc.Parse(str.c_str());

	if (!doc.Error())
	{
		TiXmlNode* node;
		node=doc.FirstChild();
		node=node->FirstChild();
		for (;node!=0;node=node->NextSibling()) 
		{
			if (node->Type() == TiXmlNode::ELEMENT)
			{
				//get params
				String name = "";
				String file = "";

				if (strcmp(node->Value(), "sound") == 0)
				{
					TiXmlAttribute* att = node->ToElement()->FirstAttribute();
					while (att)
					{
						if (strcmp(att->Name(), "name") == 0)
						{
							name = att->Value();
						}
						else if (strcmp(att->Name(), "file") == 0)
						{
							file = att->Value();
						}
						att = att->Next();
					}

					if (name.length() > 0)
					{
						SND->LoadSound(name, file);
					}
				}
			}
		}
	}
	else
	{
		throw Exception(Exception::ERR_FILE_NOT_FOUND, std::string(doc.ErrorDesc()) + " : particles.xml", __FUNCTION__);
	}
}
开发者ID:drwbns,项目名称:1stperson,代码行数:50,代码来源:zzzSndSystem.cpp

示例4: SetMainMenu

void LangHelper::SetMainMenu(HMENU hMenu)
{
	if (!hMenu){
		return ;
	}

// 	<Menu>
// 		<Main>
// 			<Entries>

	TiXmlNode *mainMenu = _pXmlDoc->FirstChild("Language");
	ASSERT_POINTER(mainMenu);

	mainMenu = mainMenu->FirstChild("Menu");
	ASSERT_POINTER(mainMenu);

	mainMenu = mainMenu->FirstChild("Main");
	ASSERT_POINTER(mainMenu);

	SetMenuEntries(mainMenu->FirstChild("Entries"), hMenu);
	SetMenuSubEntries(mainMenu->FirstChild("SubEntries"), hMenu);
	SetCommandMenu(mainMenu->FirstChild("Command"), hMenu);
}
开发者ID:hisham2300,项目名称:navifirmex,代码行数:23,代码来源:LangHelper.cpp

示例5: doc

const String& MimeType::comment(void) {
	// calling without mime loaded do nothing
	if(!(status & MIME_LOADED))
		return mcmt;

	if(status & COMMENT_LOADED)
		return mcmt;

	String ttype = mtype;
	ttype += ".xml";

	const char* p = xdg_mime_find_data(ttype.c_str());
	if(!p)
		return mcmt;

	String path = p;
	
	TiXmlDocument doc(path.c_str());

	if(!doc.LoadFile()) {
		E_DEBUG(E_STRLOC ": MimeType::comment() %s malformed\n", path.c_str());
		return mcmt;
	}

	TiXmlNode* el = doc.FirstChild("mime-type");

	/*
	 * First element which does not have "xml:lang" attribute
	 * is default one. So hunt that one :)
	 *
	 * Btw. TinyXML does not handle XML namespaces and will return
	 * "<namespace>:<attribute>" value. This is not big deal as long
	 * as correctly fetch attribute values.
	 */
	for(el = el->FirstChildElement(); el; el = el->NextSibling()) {
		if(strncmp(el->Value(), "comment", 7) == 0) {
			// TODO: add locale here
			if(!el->ToElement()->Attribute("xml:lang")) {
				TiXmlText* data = el->FirstChild()->ToText();
				if(data) {
					mcmt = data->Value();
					break;
				}
			}
		}
	}

	status |= COMMENT_LOADED;
	return mcmt;
}
开发者ID:edeproject,项目名称:svn,代码行数:50,代码来源:MimeType.cpp

示例6: TiXmlFindElement

	TiXmlElement* TiXmlFindElement(TiXmlDocument* doc, const xdl_char* elements) {
		std::vector<std::string> tokens;
		size_t number = xstd::tokenize(elements, tokens, "/");
		TiXmlNode* child = doc;
		size_t count = 0;
		while(count < number) {
			child = child->FirstChild(tokens[count].c_str());
			count++;;
		}
		if(child != NULL)
			return child->ToElement();

		return NULL;
	}
开发者ID:yaakuro,项目名称:XdevLSDK,代码行数:14,代码来源:XdevLUtils.cpp

示例7: HandleCallback

bool RequestLCGetVideoTask::HandleCallback(const string& url, bool requestRet, const char* buf, int size)
{
	FileLog("httprequest", "RequestLCGetVideoTask::HandleResult( "
			"url : %s,"
			"requestRet : %s "
			")",
			url.c_str(),
			requestRet?"true":"false"
			);

	if (size < MAX_LOG_BUFFER) {
		FileLog("httprequest", "RequestLCGetVideoTask::HandleResult( buf( %d ) : %s )", size, buf);
	}

	string errnum = "";
	string errmsg = "";
	string videoUrl = "";
	bool bFlag = false;
	bool bContinue = true;
	if (requestRet) {
		// request success
		TiXmlDocument doc;
		if( HandleResult(buf, size, errnum, errmsg, doc, &bContinue) ) {
			bFlag = true;

			TiXmlNode *rootNode = doc.FirstChild(COMMON_ROOT);
			if (NULL != rootNode) {
				// group list
				TiXmlNode *videoNode = rootNode->FirstChild(LC_GETVIDEO_VIDEO_URL);
				if (NULL != videoNode) {
					TiXmlElement* videoUrlElement  = videoNode->ToElement();
					if (NULL != videoUrlElement) {
						videoUrl = videoUrlElement->GetText();
					}
				}

			}
		}
	} else {
		// request fail
		errnum = LOCAL_ERROR_CODE_TIMEOUT;
		errmsg = LOCAL_ERROR_CODE_TIMEOUT_DESC;
	}

	if( bContinue && mpCallback != NULL ) {
		mpCallback->OnGetVideo(bFlag, errnum, errmsg, videoUrl, this);
	}

	return bFlag;
}
开发者ID:KingsleyYau,项目名称:Dating4Lady,代码行数:50,代码来源:RequestLCGetVideoTask.cpp

示例8: FindLNType

int CXGseScd::FindLNType(TiXmlNode *pLN0Node, const std::string &prefix, const std::string &ln_class, const std::string &ln_inst, const std::string &do_name, std::string &ds_desc, std::string &ln_type)
{
    TiXmlNode *pXmlLNNode = pLN0Node->NextSibling("LN");
    TiXmlElement *pLNElement = NULL;
    while (pXmlLNNode != NULL)
    {
        pLNElement = pXmlLNNode->ToElement();
        if ((ln_class == pLNElement->Attribute("lnClass"))
            && (ln_inst == pLNElement->Attribute("inst"))
            && ((prefix == "")
            || (prefix == pLNElement->Attribute("prefix"))))
        {
            ln_type = pLNElement->Attribute("lnType");
            TiXmlNode *pDONode = pXmlLNNode->FirstChild("DOI");
            while (pDONode != NULL)
            {
                if (pDONode->ToElement()->Attribute("name") == do_name)
                {
                    TiXmlNode *pDANode = pDONode->FirstChild("DAI");
                    while (pDANode != NULL)
                    {
                        if (pDANode->ToElement()->Attribute("name") == std::string("dU"))
                        {
                            ds_desc = pDANode->FirstChildElement("Val")->GetText();
                            break;
                        }
                        pDANode = pDANode->NextSibling();
                    }
                    return J_OK;
                }
                pDONode = pDONode->NextSibling();
            }
        }
        pXmlLNNode = pXmlLNNode->NextSibling("LN");
    }
    return J_NOT_FOUND;
}
开发者ID:dulton,项目名称:jorhy-prj,代码行数:37,代码来源:x_gse_scd.cpp

示例9: find_fileconfiguration

void find_fileconfiguration( TiXmlElement* pElement , const char* filepath )
{	
	char buffer[128] = STR_FALSE;
	TiXmlNode* pNode = pElement->FirstChild();
	while( pNode )
	{		
		if ( strcmp( pNode->Value() , ELEMENT_NAME ) )
		{
			TiXmlNode* ptemp = pNode->NextSibling();
			pNode = ptemp;
			continue;
		}

		const char* text = pNode->FirstChild()->ToText()->Value();
		const char* check_str = pNode->ToElement()->Attribute( ATTRIBUTE_NAME );

		if ( !strcmp( check_str , ATTRIBUTE_TEXT_DEBUG ) )
		{
			strcpy_s( buffer , pNode->FirstChild()->ToText()->Value() );
			if ( !strcmp( buffer , STR_TRUE ) )
			{		
				g_except_file_table.push_back( filepath );
			}
		}

		TiXmlNode* ptemp = pNode->NextSibling();
		pElement->RemoveChild( pNode );
		pNode = ptemp;
	}

	push_excludedfrombuild( pElement , ELEMENT_NAME, ATTRIBUTE_NAME, ATTRIBUTE_TEXT_DEBUG, buffer );
	push_excludedfrombuild( pElement , ELEMENT_NAME, ATTRIBUTE_NAME, ATTRIBUTE_TEXT_DEBUG_UNITY, "true" );

	push_excludedfrombuild( pElement , ELEMENT_NAME, ATTRIBUTE_NAME, ATTRIBUTE_TEXT_RELEASE, buffer );
	push_excludedfrombuild( pElement , ELEMENT_NAME, ATTRIBUTE_NAME, ATTRIBUTE_TEXT_RELEASE_UNITY, "true" );	

}
开发者ID:rodrigobmg,项目名称:choding,代码行数:37,代码来源:all_cpp.cpp

示例10: mainProcessorIni

void XMLreader::mainProcessorIni( std::vector<TiXmlNode*> pParentVect )
{
    std::map<int, TiXmlNode*> parents;
    for (unsigned iParent=0; iParent<pParentVect.size(); ++iParent) {
        EPC_ASSERT( pParentVect[iParent]->Type()==TiXmlNode::DOCUMENT ||
                          pParentVect[iParent]->Type()==TiXmlNode::ELEMENT );

        TiXmlElement* pParentElement = pParentVect[iParent]->ToElement();
        int id=0;
        if (pParentElement) {
            const char* attribute = pParentElement->Attribute("id");
            if (attribute) {
                std::stringstream attributestr(attribute);
                attributestr >> id;
            }
        }
        parents[id] = pParentVect[iParent];
    }

    std::map<int, TiXmlNode*>::iterator it = parents.begin();
    name = it->second->ValueStr();

    for (; it != parents.end(); ++it) {
        int id = it->first;

        TiXmlNode* pParent = it->second;
        Data& data = data_map[id];
        data.text="";

        typedef std::map<std::string, std::vector<TiXmlNode*> > ChildMap;
        ChildMap childMap;
        TiXmlNode* pChild;
        for ( pChild = pParent->FirstChild(); pChild != 0; pChild = pChild->NextSibling()) 
        {
            int type = pChild->Type();
            if ( type==TiXmlNode::ELEMENT ) {
                std::string name(pChild->Value());
                childMap[name].push_back(pChild);
            }
            else if ( type==TiXmlNode::TEXT ) {
                data.text = pChild->ToText()->ValueStr();
            }
        }
        for (ChildMap::iterator it = childMap.begin(); it != childMap.end(); ++it) {
            std::vector<TiXmlNode*> pChildVect = it->second;
            data.children.push_back( new XMLreader( pChildVect ) );
        }
    }
}
开发者ID:cndesantana,项目名称:epicell,代码行数:49,代码来源:TINYXML_xmlIO.cpp

示例11: tixmldocument_write

  int tixmldocument_write(lua_State *L) {
    TiXmlDocument *xmldoc;
    TiXmlDocument_ud* xmldoc_userdata = (TiXmlDocument_ud *) luaL_checkudata(L, 1, "TiXmlDocument");
    xmldoc = xmldoc_userdata->xmldoc;
    const char *path = luaL_checkstring(L, 2); // path
    const char *value = luaL_checkstring(L, 3); // new value

    lua_pop(L, 3);

    char *attr_name;
    TiXmlNode *node = find_node(path, xmldoc->RootElement(), &attr_name);

    if (node) {
      if (attr_name) {
	if (node->Type() == TiXmlNode::ELEMENT) {
	  TiXmlElement *elt_node = dynamic_cast<TiXmlElement *>(node);

	  if (elt_node->Attribute(attr_name)) {
	    elt_node->SetAttribute(attr_name, value);
	    delete attr_name;
	    lua_pushboolean(L, 1);
	    return 1;
	  }
	}
	luaL_error(L, "invalid attribute: %s", attr_name);
	delete attr_name;
	return 0;
      } else {
	TiXmlNode *n = node->FirstChild();
	if (n) {
	  if (n->Type()==TiXmlNode::TEXT) {
	    n->SetValue(value);
	  } else {
	    return luaL_error(L, "%s does not point to a text node", path);
	  }
	} else {
	  // create the text child
	  TiXmlText *new_text_node = new TiXmlText(value);
	  // and add it
	  node->LinkEndChild(new_text_node);
	}
      }

      lua_pushboolean(L, 1);
      return 1;
    } else {
      return luaL_error(L, "path not found: %s", path);
    }
  }
开发者ID:theypsilon,项目名称:MOD_TinyXML,代码行数:49,代码来源:ltxml.cpp

示例12: atoi

GupExtraOptions::GupExtraOptions(const char * xmlFileName) : _proxyServer(""), _port(-1)//, _hasProxySettings(false)
{
	_xmlDoc.LoadFile(xmlFileName);

	TiXmlNode *root = _xmlDoc.FirstChild("GUPOptions");
	if (!root)
		return;
		
	TiXmlNode *proxyNode = root->FirstChildElement("Proxy");
	if (proxyNode)
	{
		TiXmlNode *serverNode = proxyNode->FirstChildElement("server");
		if (serverNode)
		{
			TiXmlNode *server = serverNode->FirstChild();
			if (server)
			{
				const char *val = server->Value();
				if (val)
					_proxyServer = val;
			}
		}

		TiXmlNode *portNode = proxyNode->FirstChildElement("port");
		if (portNode)
		{
			TiXmlNode *port = portNode->FirstChild();
			if (port)
			{
				const char *val = port->Value();
				if (val)
					_port = atoi(val);
			}
		}
	}
}
开发者ID:AnsonX10,项目名称:bitfighter,代码行数:36,代码来源:xmlTools.cpp

示例13: Read

void ConfigManager::Read(const wxString& name, ConfigManagerContainer::StringToStringMap* map)
{
    wxString key(name);
    TiXmlElement* e = AssertPath(key);

    TiXmlHandle parentHandle(e);
    TiXmlNode *mNode = parentHandle.FirstChild(cbU2C(key)).FirstChild("ssmap").Node();

    TiXmlNode *curr = 0;
    if(mNode)
    {
        while((curr = mNode->IterateChildren(curr)))
            (*map)[cbC2U(curr->Value())] = cbC2U(curr->FirstChild()->ToText()->Value());
    }
}
开发者ID:469306621,项目名称:Languages,代码行数:15,代码来源:configmanager.cpp

示例14: validateTools

void DownloadToolTask::validateTools()
{
	std::vector<DesuraId> toolList;
	getItemInfo()->getCurrentBranch()->getToolList(toolList);

	if (toolList.size() == 0)
		return;

	if (!getUserCore()->getToolManager()->areAllToolsValid(toolList))
	{
		//missing tools. Gather info again
		TiXmlDocument doc;

		getWebCore()->getItemInfo(getItemId(), doc, MCFBranch(), MCFBuild());

		TiXmlNode *uNode = doc.FirstChild("iteminfo");

		if (!uNode)
			throw gcException(ERR_BADXML);

		TiXmlNode *toolNode = uNode->FirstChild("toolinfo");

		if (toolNode)
			getUserCore()->getToolManager()->parseXml(toolNode);

		TiXmlNode *gameNode = uNode->FirstChild("games");

		if (!gameNode)
			throw gcException(ERR_BADXML);

		getItemInfo()->getCurrentBranch()->getToolList(toolList);
	}

	if (!getUserCore()->getToolManager()->areAllToolsValid(toolList))
		throw gcException(ERR_INVALID, "Tool ids cannot be resolved into tools.");
}
开发者ID:Alasaad,项目名称:Desurium,代码行数:36,代码来源:DownloadToolItemTask.cpp

示例15:

void sqr_tools::CAnimationGroupEditImp::SaveNewAGPFile( std::string name )
{
	std::string keyName = "AddAGPBt";
	string pathFileValue;
	TiXmlNode* pConfigXml = CEditorConfig::GetInst()->GetEditorConfig("FileDialogSetting");
	TiXmlElement* pElement = pConfigXml->ToElement();
	TiXmlNode* pNode = NULL;
	pNode = pConfigXml->FirstChild(keyName);
	if(pNode)
	{
		pElement=pNode->ToElement();
		pElement->SetAttribute("Path",name);
		CEditorConfig::GetInst()->SaveEditorConfig();
	}
}
开发者ID:LaoZhongGu,项目名称:RushGame,代码行数:15,代码来源:CAnimationGroupEditImp.cpp


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