I’ve always wondered what XML really is, and today I have gotten a glimpse of it. So I was tasked to make some changes to the XML file that holds a schema to hold some extension data I need to create for the past two weeks.
The data is created at run-time, and needs to be permanently stored, so that it can be loaded and used after the application is closed. A trivial but important feature in most applications. So, how do you that?
Well it turns out you need to write some definition file in the form of a xsd file, sort of define what a XML tag is, what kind of information it is going to hold, and how the program is going to read it. So for example, I need to modify the definition file so that it can read the tag <OptimizationKey blah blah …. />.
Once this definition file, which is more or less in plain English, is written, you use a xsd executable to convert it to a source file that the project solution can understand and compile. So it’s converting your definition file to real C# source file.
The rest is just modifying the reader/writer classes to interpret the XML and write to XML accordingly. It turns out to be an easy 1hr job at the max, and 15 min for the astute programmer.