Xml Append

  • Thread starter Thread starter Peter
  • Start date Start date
P

Peter

I have an Access database and it has several tables, I would like to export some of the data from those tables into one XML file.
Is there a way to append data to XML file or merge all the data from all the tables into one XML file

I am using the following code, but it overwrites data for every dataset.
DataSet ds = new DataSet();
....
....
....
ds.WriteXml(@"C:\outputfile.xml", System.Data.XmlWriteMode.WriteSchema);


Peter
 
Hi Peter,

Thanks for posting in this group.
Based on my understanding, you want to append some database table data into
xml file.
I think the simplest way to get this done is merging dataset.
First you should read your original xml file into a dataset, then you can
use DataSet.Merge method to merge this dataset with your new dataset.
At last, you can Use DataSet.WriteXml to write a new xml file(Append is
getting done).
Note: The DataSet.Merge method is used to merge two DataSet objects that
have largely similar schemas.

Have a nice day!

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
Thanks for your help.

I have a few tables that are different and I want to select some data from
each table and put this data in one file so I can send this file to
different people.

I think what I will do is create separate file for each DataSet and put
these files into one ZIP file.
 
Hi Peter,

Thanks for your feedback.
From your description in this post, I do not see the need of merging
serveral tables into one xml file.
So I think maybe you need write them in different files.
Also, if your tables are different and still want to merge them into one
xml file, I think you should do the appending yourself:
Navigate to certain xmlnode and use XmlNode.AppendChild to append data.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
Back
Top