• Advertisement
Sign in to follow this  

[C++] Reading XML files tutorial

This topic is 3547 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

I've got myself the xerces xml parser but I don't any idea how to use it. the thing is that I'dont know much about XML (I've gone through tutorials, but I figured out that wasn't enough). so I have some questions: What is DOM,SAX? these names were popping up lot What must I learn if I wan't to load XML files in my app with C++?

Share this post


Link to post
Share on other sites
Advertisement
DOM stands for Document Object Model. SAX stands for Simple API for XML. That's a lot of buzzwords, but what it comes down to is that a DOM parser will create a structure in memory that contains all XML nodes. XML nodes can have nodes inside them so it's essentially a tree structure. Once a DOM parser is finished you can go through this structure to find the data you need. A SAX parser works a little different: it doesn't build a structure, but it allows you to specify the actions to take whenever the parser finds a specific element. Pretty useful if you're only looking for some specific data and you don't want to waste memory on a full-blown structure.

Share this post


Link to post
Share on other sites
thanks for the explanation. does anyone know any good tutorials, step-by-step, from creating a simple xml file to loading and reading it in C++?

Share this post


Link to post
Share on other sites
Quote:
Original post by n3Xus
What must I learn if I wan't to load XML files in my app with C++?


I would suggest using TinyXML, or possibly TinyXML++ if you're an advanced C++ programmer. Both of these are fairly lightweight (certainly lighter than Xerces) and well-documented C++ XML parsers.

Share this post


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

  • Advertisement