Cernunnos Manual


<node-iterator>

Description:

Iterates over the node list resulting from the specified XPath expression. For each node in the list, this task will set the specified request attribute and then execute its subtasks.

Reagents:

Name XPath Description Reagent Type Expected Type Required
ATTRIBUTE_NAME @attribute-name Optional name under which the new connection will be registered as a request attribute. If omitted, the name 'Attributes.NODE' will be used. PHRASE java.lang.String No
XPATH @xpath The XPATH expression this task will iterate over. PHRASE java.lang.String Yes
SOURCE @source Optional source node to evaluate XPATH against. If not specified, the value of the request attribute 'Attributes.NODE' will be used. PHRASE org.dom4j.Node No
SUBTASKS * The set of tasks that are children of this task. NODE_LIST java.util.List No

Examples:

Parses a document from the resource at 'properties/db/data.xml', creates a node list from the expression '//table/name', and writes the text value of each node to System.out:

 
       
        <node-iterator source="${parseXml(properties/db/data.xml)}" xpath="//table/name"> 
          <echo-ln>${valueOf(.)}</echo-ln> 
        </node-iterator>