10-26-2018 07:10 AM
I have tried to extract FORMULADT, MUX data types from CDD file.
But I could not find the formula information. I could read FORMULADT, MUXDT type by accessing through ( DATATYPES child node -> Attributes->ArrayofNodes->Node name and Value). I only can check "Node name: usage & Node value : coded2Phys." but no formula information.
Could anyone inform me how to extract formula and MUX information?
And How could figure out XML structure to extract data from LabVIEW?
Many thanks,
ShawnKim
10-28-2018 05:05 PM - edited 10-28-2018 05:10 PM
The simplest way to extract the data that you need from XML (the format used in a Candela .cdd file) is to use XPATH expressions.
Here is an example of getting the value from a formula node using the LabVIEW inbuilt XML parser. The "Get First Matched Node.vi" evaluates the XPATH expression and returns the first matching node.
Several years ago I uploaded an example program for extracting data from a .cdd file using the inbuilt LabVIEW XML functions, however I stopped using that method shortly after because it is incredibly slow in comparison to the something like libxml2.
You can find the LabVIEW libxml2 wrappers here: https://forums.ni.com/t5/Example-Program-Drafts/Parsing-XML-is-too-slow-or-is-it/ta-p/3492686
This is what the solution looks like using the libxml2 wrappers...
As far as the XML structure goes, XML is plain text. I use the free app Notepad++ to view it and set it recognise the .cdd file format as xml so it formats it nicely and allows me to collapse and expand nodes.
10-29-2018 11:56 AM
Thank you so much, Troy!
I allocated GetNodeTextContent.vi to the correct child node from example program for extracting data from a .cdd file using the inbuilt LabVIEW XML function , and I used Evaluate Equations using Eval Formula node to get the result from the formula.
I will have to use libxml2 wrappers to make a faster automation system in the future.
Thank you again.
Shawn Kim
10-29-2018 12:11 PM
I used the LabVIEW libxml2 solution, which resulted in an execution time that was at least 340x faster than the NI solution! I was desperate for a better solution because I had 340 data packets to parse from an XML file, and each data packet took a little over 1 second to parse using NI nodes - almost six minutes! With LabVIEW libxml2, it took less time to parse ALL the packets than it did to parse ONE packet the NI way! (Less than one second!) I literally LOL'd - and I was glad I wasn't eating or drinking anything when I ran it.
There's a learning curve, but it was worth it.
12-03-2019 09:47 AM
Hi @ShawnKim7,
By any chance, were you trying to use this along with the NI ADCS Toolkit? And were you able to interpret the data with the CDD diagnostic database?