Was this helpful?
XPath Iterator
The XPath Iterator is a non-XML language used to iterate through and identify specific sections in an XML document. Use XPath Iterator to extract content from an XML document and iterate over the extracted result set.
XPath Iterator 1.1.0, 1.1.1, and 1.2.1 versions are supported.
The XPath Iterator does the following:
Enables extracting data from complex XML documents
Facilitates iteration over the extracted result set
Accepts sources, and queries at design time or run time
The following skill set is recommended:
Scripting
XML
XML Path Language (XPath)
XPath Iterator Properties
The following properties are displayed only for XPath Iterator 1.1.0 and XPath Iterator 1.1.1.
Property
Description
Dynamic XPath or XML Source Document
Dynamic XPath or Dynamic XML source.
Source XML Document
Path to XML document.
In the step property, you can provide the following:
Step option value (design time) - XML file or XPath expression
Source DJMessage object (run time) - XML file or XPath expression
If the input is a source XML file, then the file content can be passed in the source message.
Source Message is the value supplied within the source DJMessage.
Supported Actions
Action
Description
PutMessage
Extracts data from an XML source document (based on the XPath expression provided) and prepares the result set.
PutMessage lists an optional source message parameter containing either an XPath expression or an XML source (URL).
The PutMessage action contains two step properties: XML source and XPath expression. You can pass the XML source or XPath expression at design time or through Source Message at run time.
GetMessage
Iterates through the result set. This action should be called after the PutMessage action. The GetMessage action requires a target DJMessage object. The maximum size limit for DJMessage is 2 GB.
Note:  The process returns error code 4 every time you call GetMessage before PutMessage.
Supported Action Parameters
Action
Parameter
Description
GetMessage
PutMessage
Message
Message string.
Supported Action Properties
There are no action properties for XPath Iterator version 1.1.0 and 1.1.1.
The following action properties are applicable only for XPath Iterator 1.2.1.
Action
Property
Description
PutMessage
XML Source
Source message
PutMessage
XPath Expression
Source message
This table outlines the various possible step property combinations supported by XPath.
XML Source
XPath Expression
Description
Example
Combination of Design and Run Time
Source Message (Content)
Expression
Provide XML content at run time
srcMsg.body=fileread("C:\people.xml")
Provide XPath expression at design time
//Person[@title="doctor"]
Source Message (URL)
Expression
Provide URL to the XML file at run time
srcMsg.Body = "C:\people.xml"
Provide XPath expression at design time
//Person[@title="doctor"]
URL
Source Message (Expression)
Provide XML content at design time
C:\people.xml
Provide XPath expression at run time
srcMsg.Body="//Person[@title="doctor"]"
Design Time
URL
Expression
Provide URL to the XML file at design time
C:\people.xml
 
 
Provide XPath expression at design time
//Person[@title="doctor"]
*Content: msg.Body = fileread("C:\myspace\people.xml")
**URL: msg.Body = "C:\myspace\people.xml"
Errors
Code
Name
Description
Reason
1
ERR_EOF
End of file reached
No more items to return
4
ERR_READERR
Component not initialized
XPath is not initialized. ERR_READERR occurs when GetMessage is called before PutMessage.
34
ERR_INVALID
Invalid XPath expression or XML source file
Error occurred while processing XPath expression or loading XML source
Possible reasons:
Invalid XPath expression or XML source
Empty field value
50
ERR_UNSPECIFIED
Unknown error
Unknown error identified by the component
Last modified date: 02/09/2024