Solved c++ xml write append

Hexui Undetected CSGO Cheats Sinkicheat PUBG Cheat

mr.moon

Newbie
Full Member
Nobleman
Aug 29, 2016
64
383
1
how write append in xml i tried that

C++:
		for (unsigned int i = 0; i != 4; i++)
		{
			tinyxml::XMLDocument xmlDoc;
			tinyxml::XMLNode* pRoot = xmlDoc.NewElement("Test");
			xmlDoc.InsertEndChild(pRoot);
			tinyxml::XMLElement* pElement = xmlDoc.NewElement("IDs");
			pElement->SetAttribute("ID", i);
			pElement->SetAttribute("ID2", 00);
			pElement->SetAttribute("ID3", 01);
			pRoot->InsertEndChild(pElement);
			xmlDoc.SaveFile("test.xml");
		}
to write into xml like that

C++:
<Test>
    <IDs ID="0" ID1="00" ID2="01"/>
	<IDs ID="1" ID1="00" ID2="01"/>
	<IDs ID="2" ID1="00" ID2="01"/>
	<IDs IDs="3" ID1="00" ID2="01"/>
</Test>
but the outer is

C++:
<Test>
	<IDs IDs="3" ID1="00" ID2="01"/>
</Test>
there no loop it just write the last line
 

Broihon

edgy 12 y/o
Escobar Tier VIP
Fleep Tier Donator
Dec 22, 2013
1,747
40,528
317
You're creating a new document on each iteration of the for loop...
 
Attention! Before you post:

Read the How to Ask Questions Guide
99% of questions are answered in the Beginner's Guide, do it before asking a question.

No Hack Requests. Post in the correct section.  Search the forum first. Read the rules.

How to make a good post:

  • Fill out the form correctly
  • Tell us the game name & coding language
  • Post everything we need to know to help you
  • Ask specific questions, be descriptive
  • Post errors, line numbers & screenshots
  • Post code snippets using code tags
  • If it's a large project, zip it up and attach it

If you do not comply, your post may be deleted.  We want to help, please make a good post and we will do our best to help you.

Community Mods