jenlion
IS-IT--Management
- Nov 13, 2001
- 215
I have a new service that watches a directory for new xml files and takes action when one is added/changed.
When I add the following code, I find that once I save a file in the watched directory, I'm no longer able to access it. My service has it locked up.
Offending code:
I'm looking for some way to force this to release the file, but not finding it. It works fine for getting the values I need, but I'd kind of like to have my file back later. Someone may want to modify and save it again. Currently, it's only released if I stop the service.
When I add the following code, I find that once I save a file in the watched directory, I'm no longer able to access it. My service has it locked up.
Offending code:
Code:
Dim xpathDoc As XPathDocument
Dim xmlNav As XPathNavigator
xpathDoc = New XPathDocument(FileName)
xmlNav = xpathDoc.CreateNavigator()
Dim payloadID As String
Dim timeStamp As String
Dim xmlNI As XPathNodeIterator
xmlNI = xmlNav.Select("/cXML")
xmlNI.MoveNext()
xmlNav = xmlNI.Current
payloadID = xmlNav.GetAttribute("payloadID", "")
timeStamp = xmlNav.GetAttribute("timestamp", "")
I'm looking for some way to force this to release the file, but not finding it. It works fine for getting the values I need, but I'd kind of like to have my file back later. Someone may want to modify and save it again. Currently, it's only released if I stop the service.