I have read the following xml file into a dataset:
<?xml version="1.0" encoding="utf-8" ?>
<listsource xmlns=" <listcount>3</listcount>
<lastUpdated>2004-02-18</lastUpdated>
<listitems>
<item itemID="1" name="item 1"></item>
<item itemID="2" name="item 2"></item>
<item itemID="3" name="item 3"></item>
</listitems>
</listsource>
Then in the dataset I have added a new row and also gone through the rows to check it is there. My problem is writing this data back to an xml file. I thought I could just use the dataset.WriteXml method but my xml file turns out like this:
<?xml version="1.0" encoding="utf-8" ?>
<listsource xmlns=" <listcount>3</listcount>
<lastUpdated>2004-02-18</lastUpdated>
<listitems>
<item itemID="1" name="item 1"></item>
<item itemID="2" name="item 2"></item>
<item itemID="3" name="item 3"></item>
</listitems>
</listsource>
<item itemID="4" name="new item 4"></item>
Can I get the new item in the correct place or would I manually have to write the xml writing each element out to make sure it does it correctly?
Thanks
Simon
<?xml version="1.0" encoding="utf-8" ?>
<listsource xmlns=" <listcount>3</listcount>
<lastUpdated>2004-02-18</lastUpdated>
<listitems>
<item itemID="1" name="item 1"></item>
<item itemID="2" name="item 2"></item>
<item itemID="3" name="item 3"></item>
</listitems>
</listsource>
Then in the dataset I have added a new row and also gone through the rows to check it is there. My problem is writing this data back to an xml file. I thought I could just use the dataset.WriteXml method but my xml file turns out like this:
<?xml version="1.0" encoding="utf-8" ?>
<listsource xmlns=" <listcount>3</listcount>
<lastUpdated>2004-02-18</lastUpdated>
<listitems>
<item itemID="1" name="item 1"></item>
<item itemID="2" name="item 2"></item>
<item itemID="3" name="item 3"></item>
</listitems>
</listsource>
<item itemID="4" name="new item 4"></item>
Can I get the new item in the correct place or would I manually have to write the xml writing each element out to make sure it does it correctly?
Thanks
Simon