From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Close all xml node references, or just top level document?

Hello All,

 

  I have been doing a lot of work with xml parsing, and my VIs are getting pretty cluttered with the "Close.vi" function that is used to close xml node references.  I understand that it is generally good practice to close all references once you have used them, and I have gotten in the habit of implementing this in my code, but I am curious if it is really needed when working with an xml file.  It seems to me that as long as you close the reference to the original xml document, as well as any new xml documents that are created, than there should be no conflicts.  The parsing VIs that I create are generally used to configure executables, so they are only run once. 

 

  Has there been any testing done that proves one way or another, if leaving xml node references un-closed will cause a conflict? 

 

Working with LV 2012.

 

Thanks much,

GSinMN     

0 Kudos
Message 1 of 2
(2,197 Views)

Not a conflict but a potential resource hog. LabVIEW refnums are generally only deallocated when they are either explicitedly closed or when the top level VI in which the refnum was opened terminates executation. So in your run once scenario you won't likely find any problems, but code ends up many times getting reused elsewhere and such lazyness can bite you later when you decide to grab some of these VIs for a different project.

Rolf Kalbermatter
My Blog
0 Kudos
Message 2 of 2
(2,181 Views)