JKI Discussion Forums
Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Can't parse Compound Elements with Attributes

#1
User is offline   Maze 

  • Group: Members
  • Posts: 3
  • Joined: 29-June 09
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.

Attached image(s)

  • Attached Image: monthly_06_2009/post-2718-1246264348.jpg
  • Attached Image: monthly_06_2009/post-2718-1246264359.jpg

0 kudos

#2
User is offline   TonP 

  • Group: Members
  • Posts: 104
  • Joined: 28-July 06

View PostMaze, on Jun 29 2009, 09:15 AM, said:

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'
Attached Image: monthly_06_2009/post-15-1246273718.png
Ton

This post has been edited by TonP: 29 June 2009 - 11:14 AM

0 kudos

#3
User is offline   Maze 

  • Group: Members
  • Posts: 3
  • Joined: 29-June 09
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.

Attached image(s)

  • Attached Image: monthly_07_2009/post-2718-1246480580.jpg

0 kudos

#4
User is offline   Jim Kring 

  • Group: JKI Team
  • Posts: 1,204
  • Joined: 15-March 06

View PostMaze, on Jul 1 2009, 01:40 PM, said:

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.

Attached Image: monthly_07_2009/post-2-1246487117.png
0 kudos

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic