HI,
I have a DataSet which returns three rows say A,B,C. Data will be in the Following format.
A B C
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' >   
<categories>    
      <category label='1'/>      
      <category label='2'/>     
      <category label='3'/>    
      <category label='4'/>  
</categories>       
 <dataset seriesName='Variable Cost'>        
     <set value='5'/>         
     <set value='6'/>          
     <set value='7'/>        
     <set value='8'/>       
 </dataset>       
 <dataset seriesName='Budgeted cost' renderAs='Line'>       
     <set value='9'/>       
     <set value='10'/>      
     <set value='11'/>      
     <set value='12'/>      
  </dataset>    
 </chart>"

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

Thanku,
Munna

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.

commented: Good suggestion. +15

Hi, check for solution here.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.