title: Principle for developing an converter/importer/exporter (for xml-based filetypes)
body: <p>I am starting to work on an application (in C#) which shall convert different file types from one to another, the files all are GPS-Trackfiles of some kind, e.g. gpx or tcx files, or also less widely distributed formats. Common to all is that they are all basically some kind of xml format, or in some cases less structured text/csv files. The problem - but also the cause for writing this - is that the information / data within the files are stored quite different, e.g. in gpx the position data (lon/lat) of a point is stored as an attribute, while in tcx it is referenced to the point as a subnode. Another example is that in some formats the distances are stored as absolute, in some as relative values. Further, I want to handle a large variety of information here, e.g. power, climbing speeds, distances up/downhill or power zones just to name a few. The most complete format, for example, stores about 30 values per track point. It seems notable that for some formats some of the vales stored in others first have to be derived by calculation of e.g. the relative distance between two Geoposition entries.</p>
  
  <p>Now for my question: I wonder what would be the best approach to deal with the described task? </p>
  
  <p>My approach so far is to use an internal DataSet as internal Storage, read the file I want to import in another (source) dataset using standard xml readers or text readers, and then fill the target (internal) DataSet by going through the source dataset row by row, table by table. I would therefore write a variety of functions to do all necessary calculations to transfer the values from source to target as required by my internal DataSet's structure.
  For writing data in a file of any format, I would then more or less reverse that approach, perhaps limited to the data fields truely relevant for a certain file type.</p>
  
  <p>Is that the proper way to achive what I'm aiming on? Is there another way to do it I am not aware of? </p>
  
  <p>Any hint is very much helping, I would like to make sure to use a suiteble way from the start since going through every data value requires a lot of calculations to be programmed, even if each single one is rather small/simple.</p>
  
  <p>Thanks for your thoughts!</p>