xml.DomDocument Load() function locking file...?

Started by David H., November 30, 2010, 11:56:30 AM

Previous topic - Next topic

David H.

If you run the following program using v2.21.10 on Windows:-

Code (genero) Select

IMPORT xml
IMPORT os

MAIN

    DEFINE any_errors SMALLINT
    DEFINE doc        xml.DomDocument

    LET doc = xml.DomDocument.create()
    CALL doc.load("h:/test.xml")
    CALL os.Path.delete("h:/test.xml") RETURNING any_errors
    DISPLAY "File Exists (Try1)? ",os.Path.exists("h:/test.xml")
    LET doc = NULL
    CALL os.Path.delete("h:/test.xml") RETURNING any_errors
    DISPLAY "File Exists (Try2)? ",os.Path.exists("h:/test.xml")

END MAIN



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

Sisavanh S.

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.