473,382 Members | 1,389 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

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 1199

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

Similar topics

2
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
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
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
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
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
by: Adrian | last post by:
Is there a way to lock records and/or files in multi user application, using C#? Adrian.
5
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
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
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
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
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.