I've done a fair bit of work with XML and for a while it was frustratingly slow parsing large XML files no matter what method I tried.
I know I'm not the only one, many have come across this issue and mostly we just learned to live with it.
My users just had to wait 30+ seconds for their information to load.
Then I started to look deeper into it. LabXML / LibXML seemed to be much faster at the open stage and a little bit faster when using xpath expressions. Not enough to change everything over though.
Then I realised all the CLF nodes were set to run in the UI thread. So I changed them all to run in 'any thread'. A few more tweaks later and it was running about 30 times faster than anything else.
Now here's the trade-off. It is a bit more tricky to use. Some of the other XML parsing methods do a fair bit of work to make them easy to use.
I don't care about easy, I want FAST.
Using the libXML functions gives you fine control over your XML operation. It isn't the simplest method, but it is fast.
If you want easy try EasyXML. If you want fast, try this.
LabXML comes in two variants. One uses MSXML, one uses the LibXML toolkit compiled for Windows. All credit for this goes to the good people at xmlsoft.org and Thijs Bolhuis who made the LabXML LabVIEW wrappers.
All I did was tweak the LabXML VIs and CLF calls. Attached is my version of the project library and the dlls needed to make it work.
For help with how to use XML or XPATH you can Google it. For help with the specific libxml functions you can go to xmlsoft.org.
There's also an example below to get you started.
I've taken the example from this thread here, where they discuss why XML parsing is so slow and did some benchmarking for how long it takes.
I left the original VI intact except for covering the LabVIEW XML functions with a diagram disable structure and adding my libXML version over the top of it so you could switch between the two.
The big example XML file (LabVIEW_Labs_RWWbig.xml) contains 40960 clusters and is a 24MB file (quite repetitive so it zips down nice and small).
(Win7 2core i5-2400)
More than 20 times faster in this example. I think it's worth it!
LibXMLUpdate(2).zip contains additions and updated consistent naming conventions. - Thanks to GarryG
VI Package manager file added.
lXMLwrap64.dll.zip added thanks to EricH
2019-07-23 - Corrected incorrect return type for xmlXPathFreeObject() was int32, should have been void.
Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.