NI Home
Cart Cart | Help
Hello Events Academic NI Developer Zone Support Solutions Products & Services Contact NI MyNI
You are here: 
NI Home > NI Developer Zone > NI Discussion Forums


Reply
Member
ninjaphil
Posts: 24

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.
Member
dotan
Posts: 28
0 Kudos

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

I am unable to parse a simple xml file:

 

<?xml version="1.0" encoding="utf-8"?>
<Timerscript>
  <Options Units="Ticks" MaskHex="F" FlickerHex="F" SaveLastFew="F" />
  <Revisions>
    <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>
  </Revisions>
</Timerscript>

Member
Jeff_T.
Posts: 189
0 Kudos

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

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. 

 

Regards,

 

Jeff Tipps

NI Systems Engineer 

Member
Řeřicha
Posts: 5
0 Kudos

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

GXML parse "LabView"XML. It is nice, but is any easy solution, how parse (read and write) common XML via LabVIEW?
Active Participant
Christian_L
Posts: 622
0 Kudos

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

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.

 

xmlparser.PNG

 

 

Christian Loew, CLA
Principal Systems Engineer, Embedded Systems
National Instruments
Please tip your answer providers with kudos.
Member
Brad B.
Posts: 3
0 Kudos

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

Does the GXML reference library handle units that are used with numerical indicators? If so, are they output as XML attributes or elements?
Member
Jeff_T.
Posts: 189
0 Kudos

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

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:

vi.lib\Utility\VariantDataType\GetNumericInfo.vi

 

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

Member
Brad B.
Posts: 3
0 Kudos

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

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 "gxml_builder.vi" 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.

 

Regards,

Brad

Member
Jeff_T.
Posts: 189
0 Kudos

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

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 GetNumericInfo.vi 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?

 

Regards,

 

Jeff Tipps

Systems Engneer - Sound and Vibration

 

 

Member
Brad B.
Posts: 3
0 Kudos

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

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?

 

Cheers,

Brad

By using this web site, you accept the Terms of Use for this web site. Please read these Terms of Use carefully before using any part of this site. Please go here for information on ni.com's copyright infringement policy.
My Profile | Privacy | Legal | Contact NI © 2011 National Instruments Corporation. All rights reserved.    |    E-Mail this Page E-Mail this Page