Community Documents

cancel
Showing results for 
Search instead for 
Did you mean: 

Using GXML to Convert Between LabVIEW and XML Data

 

Hello Everyone!

 

I posted this on Developer Zone two weeks ago but I also wanted to start a discussion here on NI Community.

 

GXML Reference Library Documentation and Download

 

I initially created GXML to make and parse human-readable configuration files for cRIO but I could see it being used in a lot of other applications. Basically you can take a data type of arbitrary complexity, flatten it to an XML string, and unflatten it back to a LabVIEW data type.  Here is a simple example where GXML is used to flatten a three element cluster to an XML string.

 

http://zone.ni.com/cms/images/devzone/epd/IntroGen.png

http://zone.ni.com/cms/images/devzone/epd/IntroString.png

 

Then you can use a type definition to convert the XML string back to a LabVIEW data type.

 

http://zone.ni.com/cms/images/devzone/epd/IntroParse2.gif

 

GXML has the same basic functionality as the native LabVIEW XML functions (Flatten to XML and Unflatten From XML) but there are several key differences:

  1. GXML is supported on RT
  2. GXML has two different parsing functions.  The "Search Parser" uses a recursive search so the type definition used for unflattening doesn't need to exactly match the type definition used to create the XML string.  This recursive searching algorithm can be quite slow for large clusters so there is a second parsing function (Quick Parser) which uses no recursion.  Quick Parser requires the parsing application to use the same type definition used to create the XML string.
  3. GXML uses a custom schema that emphasizes human readability while preserving data integrity.  Attributes are used exclusively to describe data type and structure so each LabVIEW control needs only one line in the XML string. 

 

Again please visit the Developer Zone Document directly to download and to see the detailed documentation.  I look forward to hearing your feedback!