When you want to export data, you can choose formats such as XML or csv for the data files. The XML format is more widely used for its flexibility and is desirable by many systems to be able to process the data. This article explains how to create xml files from C# classes.
Situation: Where would you use it:
- When you have to export data from one system to another system on a different platform
- When you have to setup scheduled jobs to export data
- When you want to keep a backup of key data on a regular basis. Though the database will give (better) alternatives, this technique will help you in shared hosting environments where you may want to keep a good backup of users who have signed up on your site, on a daily basis, for example.
This article touches the following technological aspects:
- C# class library
- Creating XML Schema (XSD)
- Generating C# Class file from XSD
- Generating XML files from C# object using XmlSerializer
See full article with diagrams:
http://vinbhat.wordpress.com/2008/08/19/exporting-data-creating-xml-files-using-c/