I am looking into developing a C++ application to parse xml (using the rapidxml framework), and I would like some advice on how to approach this.The file I want to parse is a XML game file that defines a set of addons for a starship ('outfits'), which have several attributes in common (like name and cost), but also fall into various categories.For example:Fixed weapons: range, rate of fireTurret weapons, range, rate of fire, turret slew speedAfterburners: acceleration modifier, fuel burn speedetc etc etcThere are at least 5 classifications of outfits (and say 3 or 4 outfits that fall into each category), and some, like the weapons, have a few attributes in common with each other, but not with other categories like afterburners.I want to write parsing code to handle each type of object and store its data in objects. I also want to minimize how much code I have to retype (i.e. make use of good OOP style so I can add new categories or tweak existing ones in the future).What is the best way to approach this? I have already started the program, but I would like to have some input on the best approach.Since this is a really broad question, I will give you some of my thoughts/specific questions so you can see what I am looking for:Should I have a basic class called 'outfit' and use inheritance to customize the parsing for each specific category (i.e. 'fixed-weapons')? Should I have multiple levels of inheritance for similar categories (i.e. 'weapons'). How can I minimize code retyping so I only have to write the specific routines for each category?Where should I handle the errors: in 'outfit', or in the derived classes? How much error handling do I need?How can I easily access these objects later? Should I make a list-object with a vector containing each object? How can I access each object by name?Any input is appreciated; you don't have to give a complete and comprehensive rundown on how to do this (though that would be nice :P).
C++ XML Parsing: Suggestions on Approach for Parsing and Storing data
c++;xml;parsing;class