Click here to Skip to main content
15,880,469 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How we create XML from DataSet.I have store records in DataSet then how we make XML.
XML will create like this Format-

XML
<pre lang="xml"><?xml version="1.0" encoding="utf-8" ?>
<OrderConfirmation>
  <PartnerID>113b3b1313b13n3</PartnerID>
  <Orders>
    <OrderInfo>
      <MBSOrderNumber>31</MBSOrderNumber>
      <PartnerOrderNumber>34</PartnerOrderNumber>
      <NewCustomerFlag>1</NewCustomerFlag>
      <EmailAddress>atest@gmail.com</EmailAddress>
      <Items>
        <ItemInfo>
          <PartnerLineID>4sdssdsd343434</PartnerLineID>
          <EAN>12</EAN>
          <Condition>ww</Condition>
          <OrderedQuantity>80</OrderedQuantity>
          <ConfirmedQuantity>81</ConfirmedQuantity>
        </ItemInfo>
      </Items>
    </OrderInfo>
  </Orders>
</OrderConfirmation>
Posted

 
Share this answer
 
hi,
you can try this.

C#
DataSet ds = new DataSet();
dt = new DataTable();
ds.Tables[0].TableName = "product";
ds.WriteXml("D:\XmlFileName.xml"); //Here D:\XmlFileName.xml is File path where you want to save file
 
Share this answer
 
Hi. this might be the useful article about Dataset and XML:
DataSets, XML Schemas, and Excel - Oh My![^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900