To download NI software, including the products shown below, visit ni.com/downloads.
Overview
This VI reads class data from an XML file and populates an object with that class data.
Description
Class data that has been stored on disk as an XML file can be brought back into LabVIEW using the XML read function. This example demonstrates how the XML file is read and the data from the file is populated into an existing object. Note that the data from an XML file can only be populated back into the same class that was used to write it to disk.
Requirements
Steps to Implement or Execute Code
Additional Information or References
VI Block Diagram
**This document has been updated to meet the current required format for the NI Code Exchange.**
Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.
This is terrific as far as it goes. It seems that this will let you add new elements to the class object cluster (say numeric 2) and still unflatten from an old XML string of the class into the object. However, the code has no way of knowing whether or not the XML had a field specifying what numeric2 was. The numeric2 comes out as 0 (presumably because that is the default value of a numeric) because it was not in the XML.
So, it's great we can do this, but it would be nice if NI provided a way for us to retain object values input to the Unflatten from XML if they are not defined in the XML string (so that we can specify default values for new controls in the class object).