I'm working on a bit of code to convert an xml file to a dataset and then write it out to a flat file for import into another program. Right now I can go through the xml file and get the nodes and attributes and store them into tstringlists as a name/value pair. What I was wondering is there a way to store a group of tstringlists in a tlist, or something else, that I can do a name/value pair on them?? Here's why I'd like to do this, lets say I have an xml file with a hierarchy like this:
order
order,component
order,component,unit
order,component,unit,accessory
order,component,unit,accessory,attribute
order,component,unit,accessory
order,component,unit,accessory,attribute
order,component,unit
order,component,unit,accessory
order,component,unit,accessory,attribute
order,component,unit,accessory
order,component,unit,accessory,attribute
order,component
order,component,unit
order,component,unit,accessory
order,component,unit,accessory,attribute
order,component,unit,accessory,attribute
Basically I have an order with 2 components, one component has 2 units each with an accessory with attributes and the other component has one unit with an accessory and attributes.
What I'd like to do is create a generic tlist then drill down the xml file to the bottom of each component and make a tstringlist of accessories attributres then back up and add each accessory tstringlist to a tlist for the unit it is in and back up and add each unit tlist to a component tlist and then back up and add the coponent tlist to the order tlist. To further complicate things each tlist could have a tstringlist in it also so I could have a unit tstringlist with attributes included with the tlist of accessories.
Can I pair the tlist values with names like in a tstringlist?? I'd love to when I add the accessories tstringlist to a unit tlist pair it with the word accessory so I can access it using the word, same with units under component and so on. The main reason I'd like to do something like this is that I will be writing modules for several different xml formats that, while similar in nature, will not have the same names for each different sections. If I could make a generic routine to fill a tlist of tlists of tstringlists and associate each item with a name it would be easier to handle rather than an individual routine per xml format. All I'd have to do is ad a small subset of routines per each format to let it match the headings/names of the tlists.
Any ideas??