I think problem is with wrong using function or something else.
This part of code is working but the result isn't well.
TiXmlElement* e = hDoc.FirstChildElement().Element(); // think problem is there
while (e)
{
    e = e->NextSiblingElement();  //or may be there
    count++;
}
The result of count is 1.
Xml file is:
<doc>
   <state> ... </state>
   <state> ... </state>
   ...
</doc>
Can't find work example.
if you read the documentation you can find the following example (which seems neater than your approach):
for( child = parent->FirstChild(); child; child = child->NextSibling() )
    count++;
But you are probably only trying to count the states so I would suggest:
for( child = parent->FirstChild("state"); child; child = child->NextSibling("state") )
You probably also want something like this:
TiXmlElement *parent = hDoc.RootElement();
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With