Of course there is a cleaner way. It's good that you're trying to find one.
To me, it looks pretty obvious.
First, parsing is always bad. You need to do composing instead of parsing.
Your problem is that your tire property and naming nomenclature are non-uniform. You can generalize it. You need to create a data model which describe all possible combinations of tire characteristics mentioned in the model/part name/number. Some combinations of those characteristics exist in real life, some are not. On the top of your model's object graph you should have the list of records which references the choice of one of possible formats, model name, size, etc. Let's say you have 5 different name formats, 4 different sized, 7 manufacturer's companies, 12 model names. Your data model has a separate container of each of these categories. Then, you create one more container of the class which defines a combination of each item of each category. It's not a problem if some fields are null.
Sorry I cannot quickly draw you a UML diagram of this simple thing.
The object graph in memory won't be a tree — it will be a graph with loops. No matter. There is a way to persist it all automatically. Use Data Contract
. It can automatically store your object graphs in XML file and restore back. See http://msdn.microsoft.com/en-us/library/ms733127.aspx
Now, when you populate a list with all possible really existing kinds of tires, you will use the container of instances of the class with those references. The text of the list item will be build based of format (one of the references) and available characteristics.
When you click on a list item, you should look at the container of those instances (you can find the selected instance by index in list and in the container, for example) and look at all the references in the class instance. Each reference will point you to the separate characteristic such as size, model number, etc.
Now, the problem is reduced to the problem of writing XML file manually. Do the following: for a bootstrap, program an incomplete sample of data graph which builds all the containers in memory and save it using the
. Keep this temporary code for future use, but not deploy it. It will produce you a sample of XML file. Data Contract files are very readable; you will immediately see how to support it. If you want, you can easily create an updater — your support tool.
No parsing, for goodness sake — you cannot make such code reliable and supportable.