Quantcast
Channel: Web Forms
Viewing all articles
Browse latest Browse all 23244

Obtain a particular XML format file from WriteXML method

$
0
0

Hello all, in my ASP.NET 3.5 webpage I need to convert a Datatable in a XML file and save it on the C:\ root of the users.

My datatable has an output like this (from my SELECT clause in the database):

Title1 Title2  up_bde Value RIC_MGP STIME-MGP UP_1 70.68 RIC_MGP STIME-MGP UP_2 3.82 RIC_MGP STIME-MGP UP_3 0.5 RIC_MI STIME-MI UP_1 0.9 RIC_MI STIME-MI UP_2 69.2 RIC_MI STIME-MI UP_3 47.03 ....

At this moment I'm using the WriteXML method of the Dataset class, like:

 

// Writing XML file
var dsExportSAP = new DataSet();
dsExportSAP.Tables.Add(result);
dsExportSAP.WriteXml("C:\\Temp\\testExport.xml");

 

This works fine, but I need a particular format for the output file. This is the desidered format (for the first record of my datatable).

 

<CVRList><Title1 Title="RIC-MGP"><Title2 Title="STIME-MGP"><UP Name="UP_1">70.68</UP></Title2></Title1>
....

Instead I got this XML file:

 

<?xml version="1.0" standalone="yes"?><NewDataSet><Table1><Title1>RIC-MGP</Title1><Title2>STIME-MGP</Title2><up_bde>UP_1</up_bde><Value>2689370.68326</Value></Table1>
  ...

How can I force this particular XML format?

Thanks a lot in advance.

Luigi


Viewing all articles
Browse latest Browse all 23244

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>