# I just don't have the grasp with TinyXML

## Recommended Posts

If someone could show me how to access this data, it would be great. I've followed the tutorials but can't get anything to load from the files in C++:
<Game>
<Window>
<title="Some Program">
<width="800">
<height="600">
<fullscreen="false">
</Window>
</Game>


I gave up after trying to get something after 3 hours. I'm just so clueless now. Thanks. :]

##### Share on other sites
Hi, here some code you might find helpfull

    TiXmlDocument xmldoc ("myxmlfile.xml");    xmldoc.LoadFile();    if (xmldoc.Error()) return false; // Errors be here    TiXmlAttribute *att = xmldoc.RootElement()->FirstAttribute();    while (att)    {        std::cout << att->Value() <<std::end;        att = att->Next();    }    TiXmlElement* child = xmldoc.RootElement()->FirstChildElement();    while (child)    {        std::cout << child->Value() <<std::endl; //the name of the tag        child = child->NextSiblingElement();    }

You can iterate every TiXmlElement to get it's sub elements and attributes. If you're not comfortable with the notion of recursion you might want to read about it. Try googling recursive programming in c++ or something of that sort.

Good Luck!

## Create an account

Register a new account

• ### Forum Statistics

• Total Topics
627719
• Total Posts
2978796

• 10
• 9
• 21
• 14
• 12