Before we show you how it's done, let's review some of the EasyXML basics. (If you'd like to skip the review, scroll down to the Scalar Elements with Attributes section, below.)
Scalar Elements
Scalar elements can be created from strings, Booleans, numerics, and other scalar LabVIEW data types. For example, here is a scalar numeric:

EasyXML treats clusters and arrays as compound elements (meaning that they have child elements).
Compound Elements
Clusters are compound elements with dissimilar child element names:

Arrays are compound elements with the same name:

Attributes
Compound Elements with Attributes
To add attributes to an element, put a cluster named "#attributes" inside a cluster. For example, here is a compound element with attributes:

Scalar Elements with Attributes
Now, to add attributes to a scalar element, things get tricky. We have to follow the same process used for creating compound element with attributes, but with a twist: we use only one scalar child element having the same name as the parent cluster.
Recall our scalar element:

To add attributes to this scalar element, we have to do the following:
1) convert the scalar into a cluster
2) add an "#attributes" cluster
3) add a scalar element with the same name as the parent cluster
Here's what that looks like:

List of Scalar Elements with Attributes
You can create multiple same-named scalar elements with attributes in the same way you create a list of normal scalars. Just drop the cluster inside of an array, as shown in the screenhot, below. Make sure that you name the array, since the cluster name will be ignored (since array element names are always ignored by EasyXML).

Download the Example VI
Scalar_Element_with_Attributes_Example.vi (62.24K)
Number of downloads: 189 (Saved in LabVIEW 7.1)
(Note, you'll need to download the EasyXML demo in order to run this example, if you don't already have the demo or full version installed.)



Back to top








