I’m currently working on a tablet game that needs to parse an XML file, which actually contains a whole database structure (several DB tables). The file is previously loaded to the tablet.
I need to select and return some elements from the XML file periodically – not at regular intervals, though. In fact, these elements are chosen according to a specific algorithm.
I’m programming in C#, and several ideas came to me, such as:
- Parsing the XML file with XmlReader every time I need to return elements
- Parsing the XML file at the beginning of the game only, saving its data to a hashtable, and working with the hashtable each time I’ll need to select elements
I could implement the former solution with Linq to XML too, but I’ve read that XmlReader was the fastest way to parse huge XML files.
The latter solution looks good to me, but I have no idea where to “store” the hashtable (in some cache memory, maybe?).
What would you advise me to do?
Thanks in advance!