Notifications
Clear all

[Closed] Writing to XML overwrite

Hey guys,

Everytime I write to an existing xml file, it overwrites all the data. Is there a way to append to the file, or is it the matter of having to read the file, modify or add to the data, then write it back out?

Thanks!

5 Replies

How are you writing the XML file? You need to open the xml, get the node and use .AppendChild

I’ll have a look at my snippets.

 PEN

Have a look how I’m writing it here. How are you doing it?

http://paulneale.com/tutorials/dotNet/xml/xml.htm

You can do root=XML.FirstChild then root.AppendChild (where XML=dotnetobject “System.Xml.XmlDocument”) then just XML.Save… I guess

Ahh that’s where was my mess up :). Thanks Artur!

Appreciate the tutorial, Paul. I’ve been referencing it time to time.

 PEN

I answered so quicky I didn’t even notice it was you J. If you need any more example code just let me know.