Example Code

Dynamically Growing XML Architecture

Code and Documents

Attachment

Download All

Utilising the power of the state machine architecture, XML technology and the behaviour of the default case this VI introduces an architecture that's able to take data from an expandable number of states and enqueue's it along with an XML name tag, this is the function of the top loop. The second loop merely takes this data, de-queues it and automatically generates the XML schema, growing automatically as your top loop expands.

Some items have been taken out of SubVI's and Strict Type Defs for readablility of the architecture, the queue's work via a reference of clusters so that as you add new queue's you can simply reference them by name via the "unbundle by name" function. A great example for using this architecture is sending data over TCP/IP or UDP within an XML format, the data in the second loop could simply be queued once a complete data set is captured and sent to the host over TCP/IP.

Output in this example: <Dataset><XMLTagName>19.209850</XMLTagName></Dataset>

Growing XML.png

Auto-Growing XML.vi is the Main VI

Applications Engineer

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Contributors