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


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

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


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

示例1: LoadMaterial

bool LoadMaterial(const char* pFilename, Material* pMtl)
{
	TiXmlDocument doc(pFilename);
	if (!doc.LoadFile())
	{
		printf("failed to load material %s\n", pFilename);
		return false;
	}
	
	TiXmlNode* pMtlRoot = doc.FirstChild("mtl");
	
	TiXmlElement* pTex0Elem = pMtlRoot->FirstChildElement("tex0");
	if (pTex0Elem)
	{
		pMtl->uTexture = LoadTexture(pTex0Elem->GetText());
	}
	
	TiXmlElement* pSpecElem = pMtlRoot->FirstChildElement("spec");
	if (pSpecElem)
	{
		pMtl->spec = StrToVec3(pSpecElem->GetText());
	}
	
	TiXmlElement* pShininessElem = pMtlRoot->FirstChildElement("shininess");
	if (pShininessElem)
	{
		pMtl->fShininess = (float)atof(pShininessElem->GetText());
	}

	printf("loaded material %s\n", pFilename);

	return true;
}
开发者ID:Allanis,项目名称:SComp,代码行数:33,代码来源:glstuff.cpp

示例2: getUnitPaserParameters

bool FunctionParsersManager::getUnitPaserParameters(TiXmlNode *functionParser, generic_string &mainExprStr, std::vector<generic_string> &functionNameExprArray, std::vector<generic_string> &classNameExprArray)
{
	const TCHAR *mainExpr = (functionParser->ToElement())->Attribute(TEXT("mainExpr"));
	if (!mainExpr || !mainExpr[0])
		return false;
	mainExprStr = mainExpr;

	TiXmlNode *functionNameParser = functionParser->FirstChild(TEXT("functionName"));
	if (functionNameParser)
	{
		for (TiXmlNode *childNode = functionNameParser->FirstChildElement(TEXT("nameExpr"));
			childNode;
			childNode = childNode->NextSibling(TEXT("nameExpr")) )
		{
			const TCHAR *expr = (childNode->ToElement())->Attribute(TEXT("expr"));
			if (expr && expr[0])
				functionNameExprArray.push_back(expr);
		}
	}

	TiXmlNode *classNameParser = functionParser->FirstChild(TEXT("className"));
	if (classNameParser)
	{
		for (TiXmlNode *childNode = classNameParser->FirstChildElement(TEXT("nameExpr"));
			childNode;
			childNode = childNode->NextSibling(TEXT("nameExpr")) )
		{
			const TCHAR *expr = (childNode->ToElement())->Attribute(TEXT("expr"));
			if (expr && expr[0])
				classNameExprArray.push_back(expr);
		}
	}
	return true;
}
开发者ID:Mewster,项目名称:TranslatorPP,代码行数:34,代码来源:functionParser.cpp

示例3: ReadFromXML

bool CSPrimMultiBox::ReadFromXML(TiXmlNode &root)
{
	if (CSPrimitives::ReadFromXML(root)==false) return false;;

	TiXmlElement *SP=root.FirstChildElement("StartP");
	TiXmlElement *EP=root.FirstChildElement("EndP");
	if (vCoords.size()!=0) return false;
	int i=0;
	while ((SP!=NULL) && (EP!=NULL))
	{
		for (int n=0;n<6;++n) this->AddCoord(0.0);

		if (ReadTerm(*vCoords.at(i*6),*SP,"X")==false) return false;
		if (ReadTerm(*vCoords.at(i*6+2),*SP,"Y")==false) return false;
		if (ReadTerm(*vCoords.at(i*6+4),*SP,"Z")==false) return false;

		if (ReadTerm(*vCoords.at(i*6+1),*EP,"X")==false) return false;
		if (ReadTerm(*vCoords.at(i*6+3),*EP,"Y")==false) return false;
		if (ReadTerm(*vCoords.at(i*6+5),*EP,"Z")==false) return false;

//		for (int n=0;n<6;++n) fprintf(stderr,"%e ",vCoords.at(i*6+n)->GetValue());
//		fprintf(stderr,"\n");

		SP=SP->NextSiblingElement("StartP");
		EP=EP->NextSiblingElement("EndP");
		++i;
	};
	return true;
}
开发者ID:bodagetta,项目名称:CSXCAD,代码行数:29,代码来源:CSPrimMultiBox.cpp

示例4: SetNewTaskLv

void LangHelper::SetNewTaskLv(HWND hDlg)
{
	if (!hDlg || !_pXmlDoc)
		return ;

	HWND hwndLV = GetDlgItem(hDlg, IDC_LIST_TASK);

	if (hwndLV == 0)
		return ;

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

	node = node->FirstChild("Dialog");
	ASSERT_POINTER(node);

	node = node->FirstChild("NewTask");
	ASSERT_POINTER(node);

	node = node->FirstChild("FileList");
	ASSERT_POINTER(node);

	TiXmlElement *item = node->FirstChildElement("FileName");

	if (item)
	{
		const char *v = item->Attribute("text");
		if (v)
		{
			LVCOLUMN lvc = {0};

			TString str(v);
			lvc.mask = LVCF_TEXT;

			lvc.pszText = (TCHAR*)str.c_str();

			ListView_SetColumn(hwndLV, 0, &lvc);
		}
	}

	item = node->FirstChildElement("FileSize");

	if (item)
	{
		const char *v = item->Attribute("text");
		if (v)
		{
			LVCOLUMN lvc = {0};

			TString str(v);
			lvc.mask = LVCF_TEXT;

			lvc.pszText = (TCHAR*)str.c_str();

			ListView_SetColumn(hwndLV, 1, &lvc);
		}
	}
}
开发者ID:hisham2300,项目名称:navifirmex,代码行数:58,代码来源:LangHelper.cpp

示例5: exception

GupDownloadInfo::GupDownloadInfo(const char * xmlString) : _updateVersion(""), _updateLocation("")
{
	_xmlDoc.Parse(xmlString);

	TiXmlNode *root = _xmlDoc.FirstChild("GUP");
	if (!root)
		throw exception("It's not a valid GUP xml.");

	TiXmlNode *needUpdateNode = root->FirstChildElement("NeedToBeUpdated");
	if (!needUpdateNode)
		throw exception("NeedToBeUpdated node is missed.");

	TiXmlNode *nun = needUpdateNode->FirstChild();
	if (!nun)
		throw exception("NeedToBeUpdated is missed.");
		
	const char *nunVal = nun->Value();
	if (!nunVal || !(*nunVal))
		throw exception("NeedToBeUpdated is missed.");
	
	if (stricmp(nunVal, "yes") == 0)
		_need2BeUpdated = true;
	else if (stricmp(nunVal, "no") == 0)
		_need2BeUpdated = false;
	else
		throw exception("NeedToBeUpdated value is incorrect (only \"yes\" or \"no\" is allowed).");

	if (_need2BeUpdated)
	{
		TiXmlNode *versionNode = root->FirstChildElement("Version");
		if (versionNode)
		{
			TiXmlNode *n = versionNode->FirstChild();
			if (n)
			{
				const char *val = n->Value();
				if (val)
				{
					_updateVersion = val;
				}
			}
		}
		
		TiXmlNode *locationNode = root->FirstChildElement("Location");
		if (!locationNode)
			throw exception("Location node is missed.");

		TiXmlNode *ln = locationNode->FirstChild();
		if (!ln)
			throw exception("Location is missed.");
			
		const char *locVal = ln->Value();
		if (!locVal || !(*locVal))
			throw exception("Location is missed.");
		
		_updateLocation = locVal;
	}
}
开发者ID:AnsonX10,项目名称:bitfighter,代码行数:58,代码来源:xmlTools.cpp

示例6: getZonePaserParameters

bool FunctionParsersManager::getZonePaserParameters(TiXmlNode *classRangeParser, generic_string &mainExprStr, generic_string &openSymboleStr, generic_string &closeSymboleStr, std::vector<generic_string> &classNameExprArray, generic_string &functionExprStr, std::vector<generic_string> &functionNameExprArray)
{
	const TCHAR *mainExpr = NULL;
	const TCHAR *openSymbole = NULL;
	const TCHAR *closeSymbole = NULL;
	const TCHAR *functionExpr = NULL;

	mainExpr = (classRangeParser->ToElement())->Attribute(TEXT("mainExpr"));
	if (!mainExpr || !mainExpr[0])
		return false;
	mainExprStr = mainExpr;

	openSymbole = (classRangeParser->ToElement())->Attribute(TEXT("openSymbole"));
	if (openSymbole && openSymbole[0])
		openSymboleStr = openSymbole;

	closeSymbole = (classRangeParser->ToElement())->Attribute(TEXT("closeSymbole"));
	if (closeSymbole && closeSymbole[0])
		closeSymboleStr = closeSymbole;

	TiXmlNode *classNameParser = classRangeParser->FirstChild(TEXT("className"));
	if (classNameParser)
	{
		for (TiXmlNode *childNode2 = classNameParser->FirstChildElement(TEXT("nameExpr"));
			childNode2;
			childNode2 = childNode2->NextSibling(TEXT("nameExpr")) )
		{
			const TCHAR *expr = (childNode2->ToElement())->Attribute(TEXT("expr"));
			if (expr && expr[0])
				classNameExprArray.push_back(expr);
		}
	}

	TiXmlNode *functionParser = classRangeParser->FirstChild(TEXT("function"));
	if (!functionParser)
		return false;

	functionExpr = (functionParser->ToElement())->Attribute(TEXT("mainExpr"));
	if (!functionExpr || !functionExpr[0])
		return false;
	functionExprStr = functionExpr;

	TiXmlNode *functionNameParser = functionParser->FirstChild(TEXT("functionName"));
	if (functionNameParser)
	{
		for (TiXmlNode *childNode3 = functionNameParser->FirstChildElement(TEXT("funcNameExpr"));
			childNode3;
			childNode3 = childNode3->NextSibling(TEXT("funcNameExpr")) )
		{
			const TCHAR *expr = (childNode3->ToElement())->Attribute(TEXT("expr"));
			if (expr && expr[0])
				functionNameExprArray.push_back(expr);
		}
		
	}
	return true;
}
开发者ID:Mewster,项目名称:TranslatorPP,代码行数:57,代码来源:functionParser.cpp

示例7: ReadFromXML

bool CSProperties::ReadFromXML(TiXmlNode &root)
{
	TiXmlElement* prop = root.ToElement();
	if (prop==NULL) return false;

	int help;
	if (prop->QueryIntAttribute("ID",&help)==TIXML_SUCCESS)
		uiID=help;

	const char* cHelp=prop->Attribute("Name");
	if (cHelp!=NULL) sName=string(cHelp);
	else sName.clear();

	TiXmlElement* FC = root.FirstChildElement("FillColor");
	if (FC!=NULL)
	{
		if (FC->QueryIntAttribute("R",&help)==TIXML_SUCCESS)
			FillColor.R=(unsigned char) help;
		if (FC->QueryIntAttribute("G",&help)==TIXML_SUCCESS)
			FillColor.G=(unsigned char) help;
		if (FC->QueryIntAttribute("B",&help)==TIXML_SUCCESS)
			FillColor.B=(unsigned char) help;
		if (FC->QueryIntAttribute("a",&help)==TIXML_SUCCESS)
			FillColor.a=(unsigned char) help;
	}

	TiXmlElement* EC = root.FirstChildElement("EdgeColor");
	if (EC!=NULL)
	{
		if (EC->QueryIntAttribute("R",&help)==TIXML_SUCCESS)
			EdgeColor.R=(unsigned char) help;
		if (EC->QueryIntAttribute("G",&help)==TIXML_SUCCESS)
			EdgeColor.G=(unsigned char) help;
		if (EC->QueryIntAttribute("B",&help)==TIXML_SUCCESS)
			EdgeColor.B=(unsigned char) help;
		if (EC->QueryIntAttribute("a",&help)==TIXML_SUCCESS)
			EdgeColor.a=(unsigned char) help;
	}

	TiXmlElement* att_root = root.FirstChildElement("Attributes");
	if (att_root)
	{
		TiXmlAttribute* att = att_root->FirstAttribute();
		while (att)
		{
			AddAttribute(att->Name(),att->Value());
			att = att->Next();
		}
	}

	return true;
}
开发者ID:koendv,项目名称:CSXCAD,代码行数:52,代码来源:CSProperties.cpp

示例8: timeUnit

			QuantLib::Period timeUnit(TiXmlNode* node)
			{
				TiXmlNode* thisNode = node->FirstChildElement("tenor");

				if(!thisNode)
					thisNode = node;

				TiXmlElement* periodMultiNode = thisNode->FirstChildElement("periodMultiplier");
				TiXmlElement* periodNode = thisNode->FirstChildElement("period");

				Integer multi = std::atoi(periodMultiNode->GetText());
				std::string period = periodNode->GetText();

				return this->timeUnit(multi,period);
			}
开发者ID:minikie,项目名称:OTCDerivativesCalculatorModule,代码行数:15,代码来源:qlTimeUnitFactory.hpp

示例9: LoadAlbumsInfo

bool CMetadataResolverMusic::LoadAlbumsInfo(BOXEE::BXXMLDocument& doc, vectorMetadata& list)
{
  TiXmlElement* pRootElement = doc.GetDocument().RootElement();
  bool bRetVal = true;
  if (pRootElement->ValueStr() == "results")
  {
    TiXmlNode* pTag = 0;
    BXMetadata album(MEDIA_ITEM_TYPE_AUDIO);

    while ((pTag = pRootElement->IterateChildren(pTag)))
    {
      if (pTag && pTag->ValueStr() == "album")
      {
        TiXmlElement* pValue = pTag->FirstChildElement();

        if (pValue && (LoadAlbumInfo(pValue,album)))
          list.push_back(album);
        else
           bRetVal = false;
      }
      else
        bRetVal = false;
    }
  }
  else
    bRetVal = false;

  return bRetVal;
}
开发者ID:sd-eblana,项目名称:bawx,代码行数:29,代码来源:MetadataResolverMusic.cpp

示例10: ReadFromXML

bool CSPrimPolygon::ReadFromXML(TiXmlNode &root)
{
	if (CSPrimitives::ReadFromXML(root)==false) return false;

	TiXmlElement *elem = root.ToElement();
	if (elem==NULL) return false;
	if (ReadTerm(Elevation,*elem,"Elevation")==false)
		Elevation.SetValue(0);

	int help;
	if (elem->QueryIntAttribute("NormDir",&help)!=TIXML_SUCCESS)
		 return false;
	m_NormDir=help;

	TiXmlElement *VT=root.FirstChildElement("Vertex");
	if (vCoords.size()!=0) return false;
	int i=0;
	while (VT)
	{
		for (int n=0;n<2;++n) this->AddCoord(0.0);

		if (ReadTerm(vCoords.at(i*2),*VT,"X1")==false) return false;
		if (ReadTerm(vCoords.at(i*2+1),*VT,"X2")==false) return false;

		VT=VT->NextSiblingElement("Vertex");
		++i;
	};

	return true;
}
开发者ID:bodagetta,项目名称:CSXCAD,代码行数:30,代码来源:CSPrimPolygon.cpp

示例11: DeleteNode

	void DirectoryWriter::DeleteNode(char *nodeName)
	{
		TiXmlDocument doc("Config.xml");
		bool loadOkay = doc.LoadFile();

		if (!loadOkay)
		{
			printf("Could not load test file 'Config.xml'. Error='%s'. Exiting.\n", doc.ErrorDesc());
			exit(1);
		}

		TiXmlNode *versionNode = 0;
		versionNode = doc.FirstChild("Version");
		TiXmlElement *versionelement = versionNode->ToElement();
		std::string version = versionelement->Attribute("Number");
		int value = atoi(version.c_str());
		value += 1;
		versionelement->SetAttribute("Number", value);

		TiXmlNode *node = 0;
		node = doc.FirstChild("Filesystem");
		TiXmlElement *searchNode = 0;

		for (TiXmlElement* e = node->FirstChildElement("File"); e != NULL; e = e->NextSiblingElement("File"))
		{
			const char *attribute = e->Attribute("filename");
			if (strcmp(attribute, nodeName) == 0)
			{
				node->RemoveChild(e);
				break;
			}
		}
		doc.SaveFile();
	}
开发者ID:BioDice,项目名称:OS3CS,代码行数:34,代码来源:DirectoryWriter.cpp

示例12: logIn

void WebCoreClass::logIn(const char* user, const char* pass, TiXmlDocument &doc)
{
	if (m_bUserAuth)
		throw gcException(ERR_ALREADYLOGGEDIN);

	PostMap post;

	post["username"] = user;
	post["password"] = pass;

	TiXmlNode* uNode = loginToServer(getLoginUrl(), "memberlogin", post, doc);
	TiXmlElement *memNode = uNode->FirstChildElement("member");
	
	if (!memNode)
		throw gcException(ERR_BADXML);

	const char* idStr =  memNode->Attribute("siteareaid");

	if (!idStr || atoi(idStr) < 0)
		throw gcException(ERR_BAD_PORU);

	m_uiUserId = atoi(idStr);

	TiXmlNode *cookieNode = memNode->FirstChild("cookies");
	if (cookieNode)
	{
		XML::GetChild("id", m_szIdCookie, cookieNode);
		XML::GetChild("session", m_szSessCookie, cookieNode);
	}

	m_bUserAuth = true;
}
开发者ID:boskee,项目名称:Desurium-1,代码行数:32,代码来源:WebCore_Internal.cpp

示例13: GetMsgBox

void LangHelper::GetMsgBox(const char *type, TString &text, TString &title)
{
	if (type == 0 || _pXmlDoc == 0)
		return ;

	TiXmlNode *nodeMsg = _pXmlDoc->FirstChild("Language");
	if (!nodeMsg)
		return ;

	nodeMsg = nodeMsg->FirstChild("MsgBox");
	if (!nodeMsg)
		return ;

	TiXmlElement *item = nodeMsg->FirstChildElement(type);
	if (item)
	{
		const char *v = item->Attribute("title");
		if (v){
			title = v;
		}
	}

	item = item->FirstChildElement("Text");
	if (item)
	{
		TiXmlNode *node = item->FirstChild();
		if (node)
		{
			const char *v = node->Value();
			if (v){
				text = v;
			}
		}
	}
}
开发者ID:hisham2300,项目名称:navifirmex,代码行数:35,代码来源:LangHelper.cpp

示例14: doc

XMLtoVecteur::XMLtoVecteur(string path) 
{
	TiXmlDocument doc(path);

	bool loadOkay = doc.LoadFile();

	if (loadOkay)
	{
		TiXmlNode* vecteurs = doc.FirstChild("Vecteurs");

		if (vecteurs != NULL)
		{
			TiXmlElement* child = vecteurs->FirstChildElement();

			while (child != NULL)
			{
				this->vecteurs.push_back(this->xmlToVecteur(child));
				child = child->NextSiblingElement();			
			} 
		}
		else
		{
			cout << "Bad document " << path << endl;
		}		
	}
	else
	{
		cout << "Failed to load file " << path << endl;
	}	
}
开发者ID:DepretA,项目名称:vecteur-xml,代码行数:30,代码来源:XMLtoVecteur.cpp

示例15: readFromXML

/**Parser xml extrai nomes de ficheiros que conteem os triângulos das figuras a desenhar*/
void readFromXML(string filename)
{
	const char * nomeFich = filename.c_str();

	TiXmlDocument doc(nomeFich);
	doc.LoadFile();
	TiXmlHandle docHandle(&doc);

	TiXmlNode * node = docHandle.FirstChild("imagem").ToNode();

	TiXmlElement * element;
	TiXmlElement * aux;

	element = node->FirstChildElement();

	readGrupoFromXML(element);

	/*BLOCO DE TESTE DO PARSER XML*/
	/*--------------------------
	TESTE
	---------------------------*/
	/*for (std::vector<Forma*>::iterator it = formas.begin(); it != formas.end(); ++it){
		(*it)->printAllTransforms();
	}*/
}
开发者ID:Safari94,项目名称:CG-Project-15-16,代码行数:26,代码来源:main.cpp


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