Four Js Development Tools Forum

Discussions by product => GWS => Topic started by: David H. on November 30, 2010, 11:56:30 am



Title: xml.DomDocument Load() function locking file...?
Post by: David H. on November 30, 2010, 11:56:30 am
If you run the following program using v2.21.10 on Windows:-

Code
  1. IMPORT xml
  2. IMPORT os
  3.  
  4. MAIN
  5.  
  6.    DEFINE any_errors SMALLINT
  7.    DEFINE doc        xml.DomDocument
  8.  
  9.    LET doc = xml.DomDocument.create()
  10.    CALL doc.load("h:/test.xml")
  11.    CALL os.Path.delete("h:/test.xml") RETURNING any_errors
  12.    DISPLAY "File Exists (Try1)? ",os.Path.exists("h:/test.xml")
  13.    LET doc = NULL
  14.    CALL os.Path.delete("h:/test.xml") RETURNING any_errors
  15.    DISPLAY "File Exists (Try2)? ",os.Path.exists("h:/test.xml")
  16.  
  17. END MAIN
  18.  
  19.  

You get the following output:-

File Exists (Try1)?           1
File Exists (Try2)?           0

My question is should Load() still be locking the file after it has completed? For me it should not but I just thought I'd mention it...

Regards,

David


Title: Re: xml.DomDocument Load() function locking file...?
Post by: Sisavanh S. on November 30, 2010, 12:24:53 pm
Hi David,

It is a known issue fixed in 2.30:
17718 - Loading a XML file doesn't close the file on disk until the DOM builder has been released

As you have noticed, the workaround is to set the reference to the document to NULL.

Thanks for reporting.

Many regards,
Sisa.