LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Read XML and return values

I am trying to figure out the easiest way to read values from an XML file. The values are then going to be used in an automation system that checks pressure values compared to these values before continuing the system. I have created an XML file that has different parameters for each program Recipe.
For Example:

 

<RecipeVault>
<Recipe>
 <name>JNR</name>
 <RoughPumpPressure>5E-2</RoughPumpPressure>
 <CoolerMotorRoughingPressure>1E-3</CoolerMotorRoughingPressure>
 <TurboPressure>9.9E-3</TurboPressure>
 <HeChargePressure>350</HeChargePressure>
 <HeVentedMotorPressure>5</HeVentedMotorPressure>
 <HiVacCoolerMotorPressure>2E-6</HiVacCoolerMotorPressure>
<WaterMoleculePressure>1E-7</WaterMoleculePressure>
</Recipe>

 

I was trying to make my own VI that could be given the name “JNR” and the parameter “RoughPumpPressure” and output the value 5E-2. I have just been running in circles trying to use the XML Parsers but no luck. I have also looked online and found the JKI program but have not tried it yet, I need IT approval to download the demo. Please let me know if there is an easy method to do this or where to find a VI that already exists that could make this work.

 

Thank you for your help!

0 Kudos
Message 1 of 5
(2,478 Views)

Repeat after me:  XPath is awesome.  Here are a couple of quick examples:

 

XML Example.png

 

Simple XPath.

 

Attached VI is a stripped out GUI to interactively request the name and parameters from auto-populating rings.

 

 

0 Kudos
Message 2 of 5
(2,458 Views)

If you don't mind creating the XMLs from within Labview....

 

I was pointed to GXML.

Which has worked wonderfully for me - and I was/am a Labview noob.

 

I have vis for the my computer target that I use to write / change values via front panel controls. These are then written to an xml file. I ftp these over to a cRIO which uses the same GXML fucnstion to parse teh xml, and load shared variables with data.

 

It has been robust, and fairly easy to expand when needed.

 

 

0 Kudos
Message 3 of 5
(2,433 Views)

Here's how I handled the XML

XML Demo.png

 

The string on the left side is your demo xml file given. Search Name and Search Parameter are the demo searched you give. Value out is the text of the field.

Hopefully I've explained each step. You can always ask if you need more info.

Certified-LabVIEW-Architect_rgb.jpgCertified_TestStand_Architect_rgb.jpg


"I won't be wronged. I won't be insulted. I won't be laid a-hand on. I don't do these things to other people, and I require the same from them." John Bernard Books

0 Kudos
Message 4 of 5
(2,428 Views)

Thank you Darin.K, just what I needed! I think I will modify the code to be able to use it as a subVI for the many steps in the system.

0 Kudos
Message 5 of 5
(2,378 Views)