cancel
Showing results for 
Search instead for 
Did you mean: 

Collection to XML

TomasKochan1
Level 4

Hi, I'd like to convert a flat collection like this:

First_Name    Last_Name     Age
John                 Smith               78
Lisa                  McDonald       24

into XML like this:

<root>
  <person>
    <First_Name>John</First_Name>
    <Last_Name>Smith</Last_Name>
    <Age>78</Age>
  </person>
  <person>
    <First_Name>Lisa</First_Name>
    <Last_Name>McDonald</Last_Name>
    <Age>24</Age>
  </person>
</root>
​Indentation is not a must but any extra attributes (eg. from serialization) are not desired.
Thank you​
1 REPLY 1

TomasKochan1
Level 4
I consider using DataSet.GetXml().
If you have better way, feel free to share it!