My XmlFile looses its tree hierarchy after saving it
-
I have been working with xml files for a while; however, now I have to work with a xml file that has several relations that are not hierarchical which makes it a bit harder to manipulate with XmlDocument so I figured I could use datasets because a dataset automatically creates all the necessary tables. So to test it out I assign a table to the datasource of a datagrid. My problem is that when new rows are added to the datagrid, and I call my dataset's WriteXml method, the new rows are added at the root level and my file looses its original tree hierarchy. For example, if my original xml file is as follows: Then I set the DataSource to of a datagrid to "Position" table and after adding a couple of rows, the saved file looks like: Note that the new rows were added in "/root" instead of in "root/Database/positions" Please let me know if there is a way to preserve the xml tree hierarchy when using datasets. Many thanks in advance.