LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Reading data from an XMLFile

Solved!
Go to solution

I was given a measurement file that is stored in XML from which I need to extract certain data.  I have spend much of the morning going through all the XML posts I could find trying to figure out how to begin.  I have also downloaded the GXML and EasyXML VI packages.  The problem is that I can't seem to figure out how to actually use any of these files because all the examples I see are very nice small files and I am not sure how to apply them to my file. 

 

The first thing I am trying to do is to extract data called CentralTilt.  If I look at the XML map in Excel it would fall under Acquistions-> SystemConfig->Data.  In Excel when I extract that data I get a column of about 1200 values.  I am trying to do the same, but place them in an array in Labview.

 

Ultimately I need to do this of a several other values within the file and then perform some additional manipulation which is why I would like to try to automate this in Labview.  I think if I can just get past this first hurdle of not really understanding how these different XML functions call on the file and parse out the data  I should be able to figure the rest out.  Some guidance would be appreciated.    Thanks.

 

 Unfortunately, I cannot post the file as it is too large, but I have a screenshot of the XML map.

Capture.PNG

0 Kudos
Message 1 of 6
(3,272 Views)

Try something like this. The XPath expression may need to be modified to fit your data structure.

 

Ben64

0 Kudos
Message 2 of 6
(3,257 Views)

I have LabView 2011 so I cannot open the file.  Could you save it to my version.  Thanks!

0 Kudos
Message 3 of 6
(3,223 Views)
Solution
Accepted by topic author Cseaman

Received some warnings while converting, you may have to replace some of the VIs used (Load and Close VIs).

 

Ben64

0 Kudos
Message 4 of 6
(3,221 Views)

It loaded just fine and  actually returned the very first value for the parameter I was looking for.Cat Very Happy  My next step will be to use this and augment it so it finds all the values.  I believe this can be done using the Get All Matched Nodes.  Let me know if I am wrong.  Thanks!

0 Kudos
Message 5 of 6
(3,216 Views)

@Cseaman wrote:

It loaded just fine and  actually returned the very first value for the parameter I was looking for.Cat Very Happy  My next step will be to use this and augment it so it finds all the values.  I believe this can be done using the Get All Matched Nodes.  Let me know if I am wrong.  Thanks!


You're right, it can be done using Get All Matched Nodes. It will return an Array of Node References. Put the Get Node Text Reference.VI with its Close.VI in a FOR loop to read all matched nodes values.

 

Ben64

Message 6 of 6
(3,208 Views)