LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Passing parameters by XML?

Hi folks,
I'm experimenting with passing parameters as XML, to address the type def. sensitivity inherent in passing LabVIEW data-types.  A sender can flatten anything to XML, and application-specific parsing functions at the receiver could gracefully handle type differences between sender's and receiver's data-structure.  No longer would a new enumeration necessarily break the caller/callee (sender/receiver) relationship until both sides are recompiled with the same type. Smiley Surprised
 
The problem is, Flatten-to-XML prints the list of enumerations every-time it sends a single enumerated value - and this is resulting in a very large string even when sending a modest amount of data.  One of my enumerated-types is a U8 with 256 enumerations - sending an array of just 10 of these enumerated values results in 10 identical lists of the 256 enumerations! Smiley Mad
 
Anybody done anything similar to address the type-def sensitivity problem?  Anybody know how to tweak LabVIEW/XML so that it's smarter and just describes the array-element-type once?
 
Cheers!
"Inside every large program is a small program struggling to get out." (attributed to Tony Hoare)
0 Kudos
Message 1 of 7
(3,826 Views)

Why not change the enum to a string version of the enum then flatten it to XML.   On the other side Parse the string and find the enum index from strings[].

 

   I have been working on my own schema but it is far from done.  It will flatten any data into a XML string with the format Lavle=tag name and inner text = string version of data,  recurses through clusters and arrays and takes almost any data as a variant input.  I have to work on the parser to repopulate the data on the other side.  This schema is much less verbose than the NI schema.  But is appealing due to its more compact and readable data format. 

 

Paul

Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA
Message 2 of 7
(3,820 Views)
Paul,
Does this have to do with reconstructing variant data?  If so, we should talk offline.
BR,
Paul

Paul
0 Kudos
Message 3 of 7
(3,809 Views)

Hi Paul,


Why not change the enum to a string version of the enum then flatten it to XML.   On the other side Parse the string and find the enum index from strings[].

VERY interesting idea, I've been chewing on it for an hour (typed 6 different responses - Smiley Tongue - )

The custom cluster disassembly/reassembly has me leaning toward a tool that just converts the arbitrary control (variant) to INI-style text - maybe just send parameters as "INI" text? (cleaner than NI's XML (with enums) and readible too.) 

Anyway, good thought - thanks!

"Inside every large program is a small program struggling to get out." (attributed to Tony Hoare)
0 Kudos
Message 4 of 7
(3,803 Views)
Yes this does use the variant and deconstructs the type and creates an XML string with the format
 
 
<control_lable [optional data_type = 'type']>
string data of control
</control_data>
 
the string data also can be a control[ ] or an array of data.
 
I have the to XML almost done and will get started on the parser soon.
 
There are a few advantages XML has over ini style data like integration with XML search techniques, browser display, built parsers, file validation ...
 
I am still teaching myself XML and have a few issues with this Variant to/from XML most notably making lables valid XML tag names building handling binary data (ie passing a picture control to XML) and adding DTD or schemas for validating the file.  Lots of work but I did learn so much about Labview data inner workings.
 
Paul
 
Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA
0 Kudos
Message 5 of 7
(3,796 Views)
 
Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA
0 Kudos
Message 6 of 7
(3,771 Views)
Hi,

It might be a little late to jump in, but JKI has just released a new toolkit called EasyXML that can easily handle arbitrary XML.

Regards,

-Jim
0 Kudos
Message 7 of 7
(3,579 Views)