Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Community » Newbie corner » [Solved] Recursively loop through XML node (Loop Through xml node)
Re: Recursively loop through XML node [message #50413 is a reply to message #50411] Tue, 23 October 2018 11:49 Go to previous message
Xemuth is currently offline  Xemuth
Messages: 387
Registered: August 2018
Location: France
Senior Member
Hello again, I find au way to fix my issue and loop through XmlNode

void loopXml(const XmlNode &xn,int cpt,String baliseToFind,bool Ok){
	XmlNode buffer(xn,cpt);
		for(int i = 0; i < buffer.GetCount(); i++){
	if(buffer.GetText().Find(baliseToFind) > 0 || Ok ){
		//Cout() << buffer.GetText().Find(baliseToFind) <<"\n";
		if(buffer[i].IsText())
			Cout() << buffer[i].GetText() << "\n";
		else
			loopXml(buffer[i],cpt++,baliseToFind,true);
	}
	else
		loopXml(buffer[i],cpt++,baliseToFind,false);
	}
}

CONSOLE_APP_MAIN
{
	String data;
	String atmTAg;
	std::ifstream fichier(String("myFile").ToStd());
	if(fichier)
	{
		std::string str((std::istreambuf_iterator<char>(fichier)),
	         			 std::istreambuf_iterator<char>());
		fichier.close();
		data = Upp::String(str);
	}
	XmlNode xn = ParseXML(data);
	loopXml(xn,0,"breaks",false);
}


function loopXml show me every text in "breaks" tags
 
Read Message icon8.gif
Read Message
Previous Topic: Linking issue...cmd line vs U++ vs Codeblocks...
Next Topic: BOOST UDP issue
Goto Forum:
  


Current Time: Fri Jun 20 23:22:41 CEST 2025

Total time taken to generate the page: 0.03228 seconds