Example of building an XML

If building your XML requires iterating over a set of data to create multiple parent and child elements, it is best to have an XML variable declared in the Start node that will act as the root element for the file. When using the XML node to build the body of this file, you will append each element to the variable. Once the process is done iterating over the data, the entire XML is written out to a file.

This section provides an example of building the following XML file:

  1. In the Start node, declare an array of companies and an array of purchase order numbers that will populate the XML file. The following process flow is used for building the XML file:
  2. In addition to the data arrays declared in the Start node, declare an XML variable that defines the element name and appropriate schema information to serve as the root element of the XML file.
  3. If you use the build wizard, the root element and the schema information are automatically added to the E4X XML Input box of the XML node that will build the body of the file. Remove the root element and schema as illustrated below:
  4. Select Append output to. In the field next to it, specify the name of your XML variable, and add the name of the element that the information will be appended to. For the sample scenario in this section, the XML variable is purchaseOrder.

    Once the process is done iterating through your data, the entire XML file will be found in the variable you defined in the Start node.