Showing results for 
Search instead for 
Did you mean: 

Reference Library for Converting Between LabVIEW and XML Data (GXML)

Please provide feedback, comments and questions on the Reference Library for Converting Between LabVIEW and XML Data (GXML) in this thread.


The latest version of the NI GXML Library is availble in VIPM on the NI LabVIEW  Tools Network repository.

Message 1 of 132

I am unable to parse a simple xml file:


<?xml version="1.0" encoding="utf-8"?>
  <Options Units="Ticks" MaskHex="F" FlickerHex="F" SaveLastFew="F" />
    <R0>Revision: 0, 3/27/2006 1:58:21 PM: Initial</R0>
    <R1>Revision: 1, 3/27/2006 2:04:28 PM: Pruned out some junk</R1>
    <R2>Revision: 2, 3/27/2006 2:06:58 PM: Added a GO command</R2>
    <R3>Revision: 3, 3/27/2006 2:18:26 PM: Fixed GO</R3>
    <R4>Revision: 4, 3/27/2006 2:20:14 PM: add sched4 freerun</R4>
    <R5>Revision: 5, 3/27/2006 8:57:55 PM: Added CONTINUOUS task</R5>
    <R6>Revision: 6, 3/28/2006 5:31:06 PM: First whack at series task</R6>
    <R7>Revision: 7, 3/28/2006 5:34:15 PM: some tweaks</R7>
    <R8>Revision: 8, 3/28/2006 5:45:15 PM: Added flicker</R8>
    <R9>Revision: 9, 3/28/2006 7:54:06 PM: MaskFix</R9>

0 Kudos
Message 2 of 132

Hello dotan,


GXML will not parse any XML string, pretty much only XML strings created by GXML.  The purpose is to encode arbitrarily complex LabVIEW data structures into a human readible format that can be parsed and brought back into LabVIEW as a user-defined data structure.  If you can represent this data as a LabVIEW cluster then GXML could be used to encode and parse that data. Sorry for the confusion. 




Jeff Tipps

NI Systems Engineer 

0 Kudos
Message 3 of 132
GXML parse "LabView"XML. It is nice, but is any easy solution, how parse (read and write) common XML via LabVIEW?
0 Kudos
Message 4 of 132

You can use the XML Parser VIs and functions available in LabVIEW to parse any generic XML.


With XML able to represent any generic data, which may not be easily represented by standard LabVIEW data types, it generally is not a trivial matter to parse any XML that you may encounter. It is much more common to use a predefined XML schema as part of your application and build a parser using these functions for your specific needs.





authored by
Christian L, CLA
Systems Engineering Manager - Automotive and Transportation
NI - Austin, TX

0 Kudos
Message 5 of 132
Does the GXML reference library handle units that are used with numerical indicators? If so, are they output as XML attributes or elements?
0 Kudos
Message 6 of 132

Hello Brad,


No currently it does not generate XML for the numerical units.  If I were to add it though I would prefer to do it as an attribute, perhaps right after the datatype attribte.


The VI which decodes the type descriptors from the variant data type is:



It appears there is an output for units though I haven't played with it yet.  I would experiment with this output and see if it supports custom units.  If it did work then it would go in the "gxml_UnflattenandScanItem" subVI in the cases that handle numeric datatypes.  It would be a pretty simple modification.  If you invest any time in it let me know and I may add it to a future release of the reference library.  I'll look into it myself when I get some time.


Best Regards,


Jeff Tipps

Systems Engineer - Sound and Vibration

0 Kudos
Message 7 of 132

Hi Jeff, 


Thanks for the reply.


I've fired up an evaluation version of LabVIEW 2009 and provided the GXML VI with a cluster with a numerical control and units as a quick test. An error exception is thrown from the "" with possible reason "Item has an unsupported datatype (Double float with unit). I tried to dive down in to the library you mention but can't get inside as it is password locked.


We're quite interested in passing the numerical units to the XML file, but are still weighing up the implications of storage as an attribute vs. an element. It certainly seems to be a case you can argue either way!


We'd certainly be interested in seeing the handling of units addressed in a future release as we have an immediate need to do such.




0 Kudos
Message 8 of 132

Ah LabVIEW treats it is its own data type.  So we would simply need to add a case to accept this new data type. 


Initial tests looks promising.  One question though.  In the example I attached I use a unit of "Pascals".  The treats that as kg/(ms^2) so I would be inclined to encode the attribute that way.  Would you consider this expected or would you expect the XML string to report Pascals?




Jeff Tipps

Systems Engneer - Sound and Vibration



0 Kudos
Message 9 of 132

I'd expect the XML string to be consistent with the input units rather than expressing in what looks to be like the 7 base SI units. Probably makes things a little bit more complex on your end unfortunately.


Is there any chance of swaying you to use an XML element instead of an attribute?




0 Kudos
Message 10 of 132