From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

enum variable in XML and in GXML

There are two things I don't understand:

1) what is the <EW> tag doing there?

2) Why the GXML generated text is not self describing?

 

I need to store data in XML or GXML format wich includes the value of an enumerated selector ring.

If I use the flatten to XML function I get:

 

<EW>
<Name>Desired_Channel_order</Name>
<Choice>Not Moving</Choice>
<Choice>CHB leads CHA</Choice>
<Choice>CHA leads CHB</Choice>
<Choice>bad reading</Choice>
<Choice>CHA only</Choice>
<Choice>CHB only</Choice>
<Val>1</Val>
</EW>

 

Obviously the enum data type is not part of the regular XML data types.

Still, I like that all the possible selector values are listed, plus the selection is listed: <Val>1</Val>.

The only thing I don't understand what is the <EW> tag doing there? What does it mean?

 

if I use the gxml_generator.vi I get this:

 

<GXML_Root>
  <Desired_Channel_order type='Enum U16' sel='CHB leads CHA'>1</Desired_Channel_order>
</GXML_Root>

 

In this case when I parse the GXML text I need to know what selection was made when the GXML text was created.

If I somehow don't know that the selection was 'CHB leads CHA' not 'CHA leads CHB' the parser sends an error.

 

 Anyone can suggest a workaround? I am not experienced with XML.

And thank you for your time and effort.

Scientia est potentia!
0 Kudos
Message 1 of 3
(2,252 Views)

The <EW> and </EW> tags indicate the start and end of the enum type. Everything related to your enum will be contained between these two tags.

 

The gxml_generator VI is actually a customer submitted VI. You can find more information here: http://zone.ni.com/devzone/cda/epd/p/id/6330

 

If you have further questions regarding the gxml_generator VI, this VI is supported on this thread:  http://forums.ni.com/t5/Components/Reference-Library-for-Converting-Between-LabVIEW-and-XML-Data/td-...

 

Hope this helps!

 

Emily C
Applications Engineer
National Instruments
0 Kudos
Message 2 of 3
(2,218 Views)

Emily,

 

Thank you for your time and effort.

I am familiar with the information that is presented on the webpages you linked me to.

 

I found a solution to my problem.

I am replacing all enums in my code with text rings.

 

This seems much easier that writing VI's to handle the XML to enum conversion.

Scientia est potentia!
0 Kudos
Message 3 of 3
(2,213 Views)