XPathQuery
The XPathQuery action executes an XPath query on an XML document value.
If an API returns a response in XML format, you can extract a certain value or set of values from the response. You can use XPath to extract values.
The following table shows the parameters for the XPathQuery action.
Name | Data type | Required | Notes |
---|---|---|---|
xmlPath | JPath | Yes | The location of the XML document in the State. |
xPathQuery | XPath | Yes | |
singleton | Boolean | No | Interprets the results as a single value instead of an array. The default is False. |
savePath | JPath | Yes | The location to store the result. |
XML Example:
This action executes the XPath query "//event/id/text()"
against the XML
document that is stored in the State at /xml_events, and stores it in the State
at location /event/id as a single value.
<XPathQuery xmlPath="/xml_events" xPathQuery="//event/id/text()" singleton="true" savePath="/event/id" />