Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XPathDocument - file stays open

Status
Not open for further replies.

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:
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.
 

Do you set all of the objects to Nothing when you are done with them?



I used to rock and roll every night and party every day. Then it was every other day. Now I'm lucky if I can find 30 minutes a week in which to get funky. - Homer Simpson

Arrrr, mateys! Ye needs ta be preparin' yerselves fer Talk Like a Pirate Day!
 
Yes, I did try that, thanks.
 
(I should be more specific. I did try that, and it didn't fix it. :) )
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top