XML Object

This is a code example for using the XML library to convert an XML string to a Lua table and to look through an XML string to find and return a tag or attribute.

Text Controller Setup

Drag in a Text Controller and name it XML. Add four Text Boxes named Input, Output, Find, and Found. (see picture below).

Next, copy the Example Code to the Text Controller.

Using the Example

In the Options Combo Box, select “Encode” or “Decode”. Enter the XML string into the Input Text Box and the result will populate in the Output Text Box. In the Find Text Box, enter the tag or attribute for which to search the XML string. If found, it populates in the Found Text Box.