Jump to content

Can't parse Compound Elements with Attributes


Maze

Recommended Posts

I can't convert the following XML string to an LabVIEW data type:

<CommunicationMessage>

<CommandMsg>

<MsgID>1298983-123321-29932</MsgID>

<Command>MyStatus</Command>

<Parameter ParamName="Status">Waiting</Parameter>

<Parameter ParamName="onlineStatus">online</Parameter>

</CommandMsg>

</CommunicationMessage>

 

See attachment "NOT ok.jpg" for my test code. The "Variant To Data.vi" report error 91 (LabVIEW: The data type of the variant is not compatible with the data type wired to the type input.). The "Easy Parse XML.vi" do not report any error.

 

The strange thing is that it works the other way around. The are no problem to create an XML string from the same LabVIEW data type as in my first example. The result string is exactly the same as the XML string above. See attachment "Ok.jpg" for the test code.

 

I am using your "EasyXML" trial version, LabVIEW 8.5 and Vista Business with SP1.

post-2718-1246264348.jpg

post-2718-1246264359.jpg

Link to comment
Share on other sites

I can't convert the following XML string to an LabVIEW data type:

The strange thing is that it works the other way around. The are no problem to create an XML string from the same LabVIEW data type as in my first example. The result string is exactly the same as the XML string above. See attachment "Ok.jpg" for the test code.

The cluster element inside the array needs to be named 'Parameter' as well, so right click on the cluster border and select 'Visible->label'

Example_VI.png

Ton

Link to comment
Share on other sites

Sorry to say but it did't help. The parser don't care about that Label. But I found the problem :D It was the element order in the array cluster that was wrong. My "Parameter" had order 0 while "#attributes" had order 1. I just switched the order and now it's working. And you can see that I changed the Label in cluster element inside the array to "Foo" and it works just fine.

post-2718-1246480580.jpg

Link to comment
Share on other sites

Sorry to say but it did't help. The parser don't care about that Label. But I found the problem :D It was the element order in the array cluster that was wrong. My "Parameter" had order 0 while "#attributes" had order 1. I just switched the order and now it's working. And you can see that I changed the Label in cluster element inside the array to "Foo" and it works just fine.

 

I'm glad to hear that you found the issue and that it was a simple fix. I'm not sure if this relates to your issue, but I usually always set cluster Autosizing to Arrange Vertically (or Horizontally), so that the cluster element order is obvious.

 

1.png

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.