Jump to content
klessm1

Possible Bug in Unflatten from XML function using classes

Recommended Posts

I am flattening an array of classes and loading into an MSSQL database in an XML column. When the XML is returned it is formatted to take up less space. Which means a line of "<Cluster></Cluster>" becomes "<Cluster/>". When returned in this manner I get an error:

1403

LabVIEW: Attempted to read flattened data of a LabVIEW class. The data is corrupt. LabVIEW could not interpret the data as any valid flattened LabVIEW class.

Lines that have <Val/> and <Name/> work ok. It is only the custer tag that has the issue. I have attached two xml files...one with <Cluster/> (doesn't work) and the other with <Cluster></Cluster> (works) for reference.

I am hoping someone at NI will take a look at this and enter a CAR if necessary because it just seems to be an overlooked item that doesn't happen much. This seems only possible with classes when a child class is empty. I don't think an empty cluster outside a class is possible.

The work around is to perform a search and replace of <Cluster/> with <Cluster></Cluster>. Easy, but shouldn't be necessary.

Using LabVIEW 2011.

BeforeReplace.xml

ClusterReplace.xml

Edited by klessm1

Share this post


Link to post
Share on other sites

CAR 328228 filed.

For future reference, posting something like this at http://forums.ni.com/ is more effective than posting it on LAVA -- the NI application engineers monitor those forums continuously and can directly file CARs and they know the known issues and workarounds better than anyone. Yes, sometimes posting here works, but no one from NI (myself included) assiduously reads every LAVA post, so bug reports like this can get easily missed.

Share this post


Link to post
Share on other sites

I was going to post on the NI site, but they have one huge LabVIEW forum so I though it might get lost. Was not aware that every post was read there. Thanks for the information and for entering the CAR.

Share this post


Link to post
Share on other sites

I was going to post on the NI site, but they have one huge LabVIEW forum so I though it might get lost. Was not aware that every post was read there. Thanks for the information and for entering the CAR.

Personally I would expect the <Cluster></Cluster> construct to throw the same error since these elements are designed to have child nodes attached.

<Name> and <Val> are child only, and are therefore OK to leave empty.

Just my 2c

/J

Share this post


Link to post
Share on other sites
For future reference, posting something like this at http://forums.ni.com/ is more effective than posting it on LAVA.

That may be so, but anyone's welcome to post about what they think are possible bugs here - so we can all discuss it, and maybe flesh it out more before it's reported.

Share this post


Link to post
Share on other sites

That may be so, but anyone's welcome to post about what they think are possible bugs here - so we can all discuss it, and maybe flesh it out more before it's reported.

This one seemed pretty specific and looking for a CAR number.

Share this post


Link to post
Share on other sites

This CAR should be fixed in LV 2012. LV will be able to parse for "<Cluster/>". By the official documentation, "<Cluster />" is legal XML as well, but LV does not allow for spaces between the tag and the forward slash when parsing any other XML tags, so I did not include that in this fix. That would be a more systemic fix to all of LV's parsing.

Share this post


Link to post
Share on other sites

It seems I messed something up... this bug is not resolved in 2012. I thought I had it fixed. And it was a double mistake: I even managed to mess up the test suite function that would have told me that it wasn't yet fixed. I am sorry.

Share this post


Link to post
Share on other sites

[...] I even managed to mess up the test suite function that would have told me that it wasn't yet fixed. [...]

My company sometimes takes this approach with design flaws that would be too expensive to fix.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

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