Chaka
Chaka

Reputation: 1541

Changing the xml structure when I use WriteXML converting DataSet to xml?

The following puts content of an excel file (one worksheet; one column) into a DataSet that needs to be an excel string:

enter image description here

        DataSet ds = excelReader.AsDataSet();

        StringWriter sw = new StringWriter();
        ds.WriteXml(sw);
        string result = sw.ToString(); 

it returns the following string:

<NewDataSet>
<Sheet2><Column1>70209429072734</Column1></Sheet2>
<Sheet2><Column1>30221442748624</Column1></Sheet2>
<Sheet2><Column1>70209433124464</Column1></Sheet2>
<Sheet2><Column1>30209434466634</Column1></Sheet2>
</NewDataSet>

I want it in this format:

<DLN>
   <id>70209429072734</id>
   <id>30221442748624</id>
   <id>70209433124464</id>
   <id>30209434466634</id>
</DLN>

Upvotes: 0

Views: 75

Answers (0)

Related Questions