I have a DataSet which returns three rows say A,B,C. Data will be in the Following format.
1 5 9
2 6 10
3 7 11
4 8 12
Now i want to convert this into xml in the below mentioned format..

<chart showValues='0' caption='Cost Analysis' numberPrefix='$' xAxisName='Quarters' yAxisName='Cost' useRoundEdges='1' >   
      <category label='1'/>      
      <category label='2'/>     
      <category label='3'/>    
      <category label='4'/>  
 <dataset seriesName='Variable Cost'>        
     <set value='5'/>         
     <set value='6'/>          
     <set value='7'/>        
     <set value='8'/>       
 <dataset seriesName='Budgeted cost' renderAs='Line'>       
     <set value='9'/>       
     <set value='10'/>      
     <set value='11'/>      
     <set value='12'/>      

Could anyone assist me with is.
Any answers are appreciated.


Edited 5 Years Ago by __avd: Added [code] tags.

The DataSet class does offer direct serialization to/from XML files, however I'm assuming your DataSet doesn't necessarily correlate to your XML schema. So, take a look at the XmlDocument class. Basically you can create XML elements and attributes using the XmlDocument's Create...() methods, than use AppendChild() on the appropriate object to build its structure. Finally use XmlDocument.Save() to generate the file.

Good suggestion.
This article has been dead for over six months. Start a new discussion instead.