To read the xml file :
XmlDocument xd = new XmlDocument();
xd.Load(filename);
To save the file:
xd.Save(filename);
but you'll have issues saying File is being used by other process - "read more about this in the link below";
So, create a filestream to be used.
XmlDocument xd = new XmlDocument();
FileStream fs = new FileStream(filename, FileMode.Open, FileAccess.ReadWrite, FileShare.ReadWrite);
xd.Load(fs);
fs.Seek(0, SeekOrigin.Begin);
fs.SetLength(0);
xd.Save(fs);
Fore more detailed explanation check this link:
No comments:
Post a Comment