Jump to content

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:


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.



Edited by klessm1
Link to comment

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.

Link to comment

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


Link to comment
  • 1 month later...

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.

Link to comment
  • 6 months later...

Join the conversation

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

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.