Example Code

Write table string to XML file & read from XML file back to table string

Code and Documents

Attachment

Overview

This VI demonstrates how to store and read data from XML file format

 

 

Description

XML is a text format for storing data.  It has advantages over simple CSV such as: extendable for future changes in parameter list, capability to add meta-data, capability to nest nodes, and others.  The XML parser can iterate over the children of an element and extract the text data.  It can also iteratively add child nodes to parent elements.  This example demonstrates this iteration by extracting a 2D array of strings from a table, writing to a file, and reading the data from the file and writing it to the table.

 

 

Steps to Implement or Execute Code

1. Open the attached project "XML_File_2D_string_Conversion_LV2012_NI Verified"  Run the VI "XML_File_2D_string_Conversion"
2. Fill in the Data in the Table and Make sure to fill in the Data header
3. Select the Path where you want to store the File or read an old one
4. Click on Save to store the Data you have written in the File or Load to load the data from the file in the table
5. Stop Execution

 

 

Additional Information or References

Block Diagram

BD.PNG

 

Front Panel
FP.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.