XmlDataSource
The XmlDataSource
is used to read an XML document from a filer. An iterator XPath expression is used to define the elements in the document over which the XmlDataSource
loops. For each of these elements multiple XPath expressions are evaluated to extract the data fields.
Configuration
Name | Type, usage constraints, defaults | Description |
---|---|---|
filename | required: paraVal default: none type: file | The file to read the XML document from. |
iterator | optional: paraVal default: //return type: xpath | Defines the nodes in the document over which the XmlDataSource iterates. The current node in the XPath expression is the document root.The default value //return can be used for JAX-WS services which name their return element return . |
data | required: paraMap default: none type: string/xpath | Defines the event's data fields using XPath queries. The current node in the XPath queries is the node the iterator expression points to. |
xpathNamespaces | optional: paraMap default: none type: string/string (uri) | Register namespace prefixes to the specified URIs. Those prefixes are used to parse the XPath expressions. The URIs specified have to match the URIs in the XML document. |
Example
<dataSource type="XmlDataSource">
<dp:paraVal name="filename" value="/path/to/file.xml"/>
<!-- loop over person tags -->
<dp:paraVal name="iterator" value="//person" />
<dp:paraMap name="data">
<value name="id" value="./@id" /> (mailto:@id)
<value name="firstname" value="./firstName/text()" />
<value name="lastname" value="./lastName/text()" />
<value name="email" value="./email/text()" />
</dp:paraMap>
</dataSource>