01-27-2020 05:44 AM
Hi,
I used to read the set of parameter data from the XML file and update each data’s in the output format of the array of cluster. While parsing the data VI taking time to parse data from the XML file.
I have made the VI based on the output format which I have required further operation.
Anyone can help me in this.
Note : VIs snapshot attached in the message.
Solved! Go to Solution.
01-27-2020 06:03 AM
Please attach code and not pictures.
If I understand what you are asking, you want us to improve the speed of the XML parsing. Is that correct?
Using XPath is slow, very slow. When I needed to parse large XML-files, I switched to a string-based xml parser instead. The one I used then was proprietary but I am sure there are others to find. Your parsing seems pretty simple, so creating some string-parsing should be possible.
01-27-2020 06:50 AM
Code is attached for your reference
If I understand what you are asking, you want us to improve the speed of the XML parsing. Is that correct? - Yes, with the same output format
01-27-2020 07:44 AM
The XML file would be useful. I didn't see it in the zip nor in the zip in the zip.
A replacement solution won't do the exact same thing for every input. It might still work properly for the correct input...
You use XPath for everything. But the cluster is hierarchical, and so is the XML file. Presumably, the XML hierarchy is resembling the cluster hierarchy. So, instead of searching with XPath, get the node matching the cluster, than link each XML child to each cluster element. There'd be no need for XPath, and going over child elements of an XML node will be much, much faster.
01-27-2020 08:08 AM
Hi Carya,
Some reasons could not able to share the XML file here.
Is this one you are talkig about ?.
Thanks
01-27-2020 08:22 AM
@dhana03 wrote:
Some reasons could not able to share the XML file here.
An edited XML file with the relevant cluster data might help.
XML is very versatile. It's hard to advice on the parsing without knowing the structure of the XML, and it's even harder to extract this structure from the code. Still not as hard as extracting it from an image of the code.
@dhana03 wrote:
Is this one you are talkig about ?.
Again, hard to tell without a file and the code.
Does it work? Is it faster? That are criteria...
01-27-2020 11:10 AM
An edited XML file with the relevant cluster data might help:
XML file attached.
Does it work? Is it faster? That are criteria...:
As we expected it's not working.
01-27-2020 11:37 AM
The built-in LabVIEW XML parsing is quite slow. See here, though the article is from 2013 I tried a while back and I still had a lot of slowdown when I tried using the built-in parser as well.
There's another post here that does speed trials on XML reading, showing that LabVIEW's XML reader slows down exponentially with the size of the file. If you increase the number of elements in XML from 20 to 210, you'd expect the execution time to go up by a factor of 10 to 11, but in the experiment it goes up by a factor of 76.
Solution is unfortunately to rewrite all your code using a different XML library.
01-28-2020 01:28 AM
01-28-2020 09:14 AM
Have look here. Using one of the libraries there, I reduced the parsing time by orders of magnitude. (~340x faster!)