Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. xml file syncronization

xml file syncronization

Scheduled Pinned Locked Moved ASP.NET
xmltutorial
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    kumarprabhakar74
    wrote on last edited by
    #1

    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

    R 1 Reply Last reply
    0
    • K kumarprabhakar74

      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

      R Offline
      R Offline
      ravie gopal
      wrote on last edited by
      #2

      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.

      K 1 Reply Last reply
      0
      • R ravie 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.

        K Offline
        K Offline
        kumarprabhakar74
        wrote on last edited by
        #3

        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

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups