I think what FourthWorld is saying is that right now you have an array that has its index keys in the following format:
Code: Select all
tArray["country1"]
tArray["country2"]
tArray["country3"]...
That makes no sense since the only way you could add data to this array is either if you knew somehow which country is stored in "country1" key or if you iterate through all the keys with a repeat and find out the country ( which i assume is what you are doing ). I assume you are following that strategy because of the tutorial you've read ( i haven't checked it ) but there is no need to go strictly by it, you can adapt to your needs.
In the example i provided, country name is the index key:
Code: Select all
tArray["France"]
tArray["Greece"]
tArray["Germany"]
So instead of repeating through all the keys to find out where "France" is stored, you can just do:
Code: Select all
put "45000" into tArray["France"]["pop"]
Your xml would look something like this:
Code: Select all
<?xml version="1.0" encoding="utf-8" ?>
<countries>
<France>
<gdp>5000</gdp>
<pop>12000000</pop>
</France>
<Greece>
<gdp>5000</gdp>
<pop>5000000</pop>
</Greece>
<England>
<gdp>5000</gdp>
<pop>24000000</pop>
</England>
</countries>
You don't need to add a "Country" node, you already know these are countries since they are under <countries> node if that's your concern.
Knowledge is meant to be shared.