Containers

This example demonstrates both containers and listener-driven output.

There is one output element, whose id is element. It has three attributes, whose ids are attr0, attr1, and attr2. They get their values by listening to the iterators whose ids are iter0, iter1, and iter2. Each attribute is added as a listener to its iterator's next event, which is fired each time next() is called on the iterator. The action that the attribute takes, when it handles the event, is to set the iterator's value into itself.

element adds itself as a listener to the list iterator whose id is container, and listens to its next events. With each event, the action it takes is to call write, which writes out the attribute values that were previously set.

The configuration is:

    
    <!-- element has 3 attributes -->
    <dmio:element id="element">
      <dmio:stream-writer/>
      <dmio:csv-format/>
      <dmio:attribute id="attr0"/>
      <dmio:attribute id="attr1"/>
      <dmio:attribute id="attr2"/>
    </dmio:element>

    <!-- first list -->
    <dm:ints range="[10,20]2">
      <dm:iterator id="iter0">
	<dm:listener listener="attr0" event="next" action="setValue"/>
      </dm:iterator>
    </dm:ints>

    <!-- second list -->
    <dm:ints range="[10,20]3">
      <dm:iterator id="iter1"/>
    </dm:ints>
    <dm:listener generator="iter1" listener="attr1" event="next" action="setValue"/>

    <!-- third list -->
    <dm:ints id="ints2" range="[10,20]5"/>
    <dm:iterator id="iter2" collection="ints2" repeat="true"/>
    <dm:listener generator="iter2" listener="attr2" event="next" action="setValue"/>

    <!-- list container -->
    <dm:list id="container" repeat="true">
      <dm:iterator reference="iter0"/>
      <dm:iterator reference="iter1"/>
      <dm:iterator reference="iter2"/>
      <dm:listener listener="element" event="next" action="write"/>
    </dm:list>
    
  

The result is:

    10,10,10
    12,13,15
    14,16,20
    16,19,10
    18,19,15