XML is created by following code.
DataSet das = new DataSet();
das = ds.Copy();
das.DataSetName = "Stock";
das.Tables[0].TableName = "Assortment";
das.Tables[0].Columns[1].ColumnName = "Item";
das.Tables[0].Columns[2].ColumnName = "Quantity";
das.Tables[0].Columns[3].ColumnName = "Price";
das.Tables[0].Columns[4].ColumnName = "ValidDate";
das.Tables[0].Columns[5].ColumnName = "Summ";
das.Tables[0].Columns[6].ColumnName = "Manufacturer";
das.Tables[0].Columns[7].ColumnName = "Supplier";
das.WriteXml(LocalPath);
I get following xml:
<Stock>
<Assortment>
<ID>1</ID>
<Item>L - тироксин Б/Х таб 100мкг №50</Item>
<Quantity>12</Quantity>
<Price>41496.0000</Price>
<ValidDate>01.01.1999</ValidDate>
<Summ>497952.0000</Summ>
<Manufacturer>Заглушка</Manufacturer>
<Supplier>Заглушка</Supplier>
</Assortment>
<Assortment>
<ID>1242</ID>
<Item>L - тироксин Б/Х таб 100мкг №50</Item>
<Quantity>12</Quantity>
<Price>10.8000</Price>
<ValidDate>01.01.1999</ValidDate>
<Summ>129.6000</Summ>
<Manufacturer>Заглушка</Manufacturer>
<Supplier>Заглушка</Supplier>
</Assortment>
</Stock>
How to add attribute to root XML? I want like this
<Stock Date="11.11.2013">
<Assortment>
<ID>1</ID>
<Item>L - тироксин Б/Х таб 100мкг №50</Item>
<Quantity>12</Quantity>
<Price>41496.0000</Price>
<ValidDate>01.01.1999</ValidDate>
<Summ>497952.0000</Summ>
<Manufacturer>Заглушка</Manufacturer>
<Supplier>Заглушка</Supplier>
</Assortment>
<Assortment>
<ID>1242</ID>
<Item>L - тироксин Б/Х таб 100мкг №50</Item>
<Quantity>12</Quantity>
<Price>10.8000</Price>
<ValidDate>01.01.1999</ValidDate>
<Summ>129.6000</Summ>
<Manufacturer>Заглушка</Manufacturer>
<Supplier>Заглушка</Supplier>
</Assortment>
Adding date attribute to Stock. Because I want to read Date when XML was created. Thanks.