Jump to content
  • Advertisement
Sign in to follow this  
Maverick Programmer

I just don't have the grasp with TinyXML

This topic is 3330 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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++:
          <title="Some Program">

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

Share this post

Link to post
Share on other sites
Hi, here some code you might find helpfull

TiXmlDocument xmldoc ("myxmlfile.xml");
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!

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!