xml file syncronization
-
I have an xml file. This xml file is used by multiuser. How to store changes made by multi user at the same time to no user lost their changes from xml file.
abc
-
I have an xml file. This xml file is used by multiuser. How to store changes made by multi user at the same time to no user lost their changes from xml file.
abc
To maintain multi user changes on a physical file, Open the file as below: FileStream fs = File.Open("C:\\abc.xml", FileMode.Open, FileAccess.ReadWrite, FileShare.Read); XmlDocument xmlDoc = new XmlDocument(); xmlDoc.Load(fs); Now you can read and update the xmlDoc object. and when you are done, you can use the same FileStream object to write back your changes to the xml file. As, we used FileAccess.ReadWrite we can read as well as write to the file. And as we used FileShare.Read we give other users only Read permission until we close the conenction.
Ravi Gopal.
-
To maintain multi user changes on a physical file, Open the file as below: FileStream fs = File.Open("C:\\abc.xml", FileMode.Open, FileAccess.ReadWrite, FileShare.Read); XmlDocument xmlDoc = new XmlDocument(); xmlDoc.Load(fs); Now you can read and update the xmlDoc object. and when you are done, you can use the same FileStream object to write back your changes to the xml file. As, we used FileAccess.ReadWrite we can read as well as write to the file. And as we used FileShare.Read we give other users only Read permission until we close the conenction.
Ravi Gopal.
Thanks for reply. Do you think instead of locking file, We have to used xQuery to Insert, Navigate, Update and Delte xml data. Do you have any example for using xQuery or any link of article who use xQuery for above operation.
abc