473,507 Members | 13,597 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Locking XML file

Hi!!

I have a web service that writes a node in xml file and saves it and
closes it. Now it is a possiblitity that several users try to edit the
same file at the same time. Is it possible to lock this xml file till
the first user closes it and then release it for the next user.

My function that writes xml file is as follows:

Public Function AddNodetoAreaXML(ByVal TeamId As String, ByVal
TeamName As String) As Boolean
Dim xDoc As New XmlDocument
Dim DocName As String =
ConfigurationSettings.AppSettings("TeamXml")
Try

xDoc.Load(DocName)
Dim NodeAreas As XmlNode = xDoc.DocumentElement
Dim ElemArea As XmlElement =
xDoc.CreateElement("Area")

Dim ElemAreaID As XmlElement =
xDoc.CreateElement("AreaId")
ElemAreaID.InnerText = TeamId
Dim ElemAreaName As XmlElement =
xDoc.CreateElement("AreaName")
ElemAreaName.InnerText = TeamName

NodeAreas.AppendChild(ElemArea)
ElemArea.AppendChild(ElemAreaID)
ElemArea.AppendChild(ElemAreaName)

xDoc.Save(DocName)
Catch ex As FileNotFoundException
Throw ex
Catch ex As Exception
Throw ex
End Try

Return True
End Function

I would really appreciate response to solve this problem.

Regards,
Sonal
Nov 12 '05 #1
0 1201

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1799
by: Geoffrey | last post by:
We have developed a python class that can read data files created from another application. These target files are C-ISAM files used for accounting applications so the "primary" application may be...
2
5807
by: Kamus of Kadizhar | last post by:
Thanks to Robert Brewer, I got enough insight into logging to make it work.... Now I have another issue: file locking. Sorry if this is a very basic question, but I can't find a handy reference...
2
2842
by: Scott Bryce | last post by:
I am creating a CGI application in Perl that uses an Access database. It will be hosted on an NT server. I have used flat file DBMs (tied hashes) on UNIX servers, but I am not familiar with how...
4
1578
by: darrel | last post by:
I've been dealing with a file locking issue for a while. Our CMS spits out a new XML file each time an item in the DB is updated. This XML file is basically our site menu, and is what we use on...
3
10383
by: dchadha | last post by:
Hi, I am working on application in C# which uses and stores data in xml file. This app can use xml file from two different ways: (a) From User Interface (Windows application) and (b) From...
5
3930
by: Adrian | last post by:
Is there a way to lock records and/or files in multi user application, using C#? Adrian.
5
4504
by: JM | last post by:
I have created a Windows Service which uses xml file as a data source. The service is running on .NET 2.0 and uses LocalSystem account. It was running fine but now it has started locking the xml...
15
5208
by: Matt Brandt | last post by:
I am trying to get multiple threads to lock specific regions of a file. However, since each thread has the same PID, it appears that a lock by one thread does not block another thread from the same...
2
1012
by: Sparky | last post by:
Hello! I am writing some software that will have many users accessing the same file resource at once for reading purposes only. I am programming on (Ubuntu) Linux and my question is in Windows, can...
9
2591
by: zmickle | last post by:
Experts and books all say that you can share an Access back end on a shared drive with the front end running on each host computer. I have a simple database that tracks student data and it is...
0
7223
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7110
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7314
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
7030
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7482
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5623
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
3191
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3179
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
411
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.