Example Code

Write LabVIEW Class Data to an XML File

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW

Code and Documents

Attachment

Overview
This VI populates the data fields of a class and then flattens the object to an XML string and writes the XML string to a file.


Description
Once a LabVIEW class has been instantiated as an object that object has a set of data associated with it. That data can be flattened to an XML string and then written to a file. This example demonstrates the ability to write class data to disk for data storage purposes. See here for an example on how to read the class data back into LabVIEW after it has been written to disk.


Requirements

  • LabVIEW 2012 (or compatible)


Steps to Implement or Execute Code

  1. Open the project and click the VI
  2. Run and view the results.

 

Additional Information or References
VI Block Diagram

 Block Diagram.png

 

 **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.

Comments
D*
Member
Member
on

Does this handle escape characters?

David-A
NI Employee (retired)
on

Not sure what you mean by 'handle'. You may need to right click your string control and change the display mode to " '/' Display Codes " to get the behavior you are looking for. Reading up on what LabVIEW means by flatten when it Flattens To XML may also answer your question.

Backslash ('\') Codes Display

http://zone.ni.com/reference/en-XX/help/371361H-01/lvhowto/backslash_codes_display/

Flattened Data

http://zone.ni.com/reference/en-XX/help/371361J-01/lvconcepts/flattened_data/