How do you create and read in .xml files for your program?

Started by
16 comments, last by mfawcett 18 years, 6 months ago
How do you create and read in .xml files for your program?
Advertisement
Using C++: TinyXML. Works well for me.
C#/.NET: System.Xml namespace
[s]--------------------------------------------------------[/s]chromecode.com - software with source code
I'm using eXpat
Quote:Original post by aaron_ds
Using C++: TinyXML. Works well for me.


And me
thanks all
Could I use tinyXML to save and open HighScore struct's for my game?
Play my Crappy Games:Stantonia.com
Quote:Original post by stanVman
Could I use tinyXML to save and open HighScore struct's for my game?


Yes, if you wanted to. XML is just a format for data to be held in. Technically, you can store anything in XML, I've seen maps, models, html data, etc... used before. Now that's not going to say it's the *best* method, but it's do-able.

If you want to use XML with a high score table, you'd want to first design the format it will be taking on, such as:
<root>   <Entry>      <Name>Unknown</Name>      <Score>1000</Score>      <Rank>1</Rank>   </Entry>   <Entry>      <Name>Unknown 2</Name>      <Score>1000</Score>      <Rank>2</Rank>   </Entry></root>

Then it's just a matter of using TinyXML to properly parse that data and extract it. Not much to it really, keep in mind that there are alternatives that might be quicker and more suited for highscores though.
Why optimise the High Score code for Speed?

P.S. You could also use an embedded SQL which might be better.
Thanks guys.
Play my Crappy Games:Stantonia.com

This topic is closed to new replies.

Advertisement