Creating an initialized array
You can create an initialized array using a Copy operation with XML Literal as the source and a process data object of the array type as the destination. Here is an example of XML Literal that is suitable for initializing an array. You can find this content in the file initializedArray.xml
in the code bundle for this chapter.
<exam:array xmlns:exam="http://www.example.org"> <exam:elem> <exam:user>user1</exam:user> <exam:outcome>APPROVE</exam:outcome> </exam:elem> <exam:elem> <exam:user>user2</exam:user> <exam:outcome>REJECT</exam:outcome> </exam:elem> </exam:array>
Let's try this now.
Add a new Process to your project. Name it as Array2.
Define a process data object named myArray of type
Data.Array
.Add a Script activity to the process. Name it InitializeArray.
Open the Implementation tab for InitializeArray and click on Data Associations.
Drag XML Literal on...