The setup: Imagine that you have a populated Recordset (in classic ASP) or a DataSet (in ASP.NET) that contains some data that you'd like to convert into an XML file. How can this be accomplished?
Using ASP.NET... With ASP.NET it is painfully easy to extract an XML representation of data out from a DataSet. It's literally as simple as calling the DataSet's GetXml() method, which returns an XML string from a populated DataSet. This technique is discussed in an article by Anthony Hart called DataGrids, DataSets, and XML Strings.
Not only is it easy to extract the XML representation of data from a DataSet, but it's also a breeze to populate a DataSet from an XML file. The DataSet contains a corresponding method ReadXml(), which populates a DataSet from an XML file. This technique is demonstrated in one of my articles, XML, the DataSet, and a DataGrid.
Using Classic ASP... With classic ASP, a Recordset's contents can be saved to an XML file using the Save() method. Unfortunately, the Save() method produces very ugly and unintelligible XML results. (To see an example of the XML content produced by the Recordset's Save() method, check out this sample XML file, which is the XML file produced by saving the results of the 10 most popular ASPFAQs.com FAQs using the Save() method.)
To create a more intelligible XML file from a Recordset's contents, you will have to write your own custom function that iterates through the Recordset's content and builds up an appropriate XML file using Microsoft's XMLDOM object. Fortunately, such a function has already been written and is discussed in Creating a Function to Stream a Recordset to XML.