Finds the value at a given path in an XML string.
XPathXMLGet([Input Data],[Path])
Where:
Input Data is the input data on which to search.
Path is the path to find in the given data object.
Example XML Data being returned to the constant DWConstantXML
<?xml version="1.0" encoding="UTF-8"?> <bookstore> <book> <title lang="en">Harry Potter</title> <price>29.99</price> </book> <book> <title lang="xml">Learning XML</title> <price>39.95</price> <difficulty>Easy</difficulty> <category>Programming</category> </book> </bookstore>
Rule | Meaning |
---|---|
XPathXMLGet(DWConstantXML,"/bookstore/book") | Will return...
<book> <title lang="en">Harry Potter</title> <price>29.99</price> </book> <book> <title lang="xml">Learning XML</title> <price>39.95</price> <difficulty>Easy</difficulty> <category>Programming</category> </book> |
XPathXMLGet(DWConstantXML,"/bookstore/book[1]") | Will return...
<book> <title lang="en">Harry Potter</title> <price>29.99</price> </book> |
Embedding the Text() function withing the path string will return just the values of the element:
Rule | Meaning |
---|---|
XPathXMLGet(DWConstantXML, "/bookstore/book/price/text()") | Will return 29.99|39.95.
This is a pipe delimited list of price element values within all book elements. |
XPathXMLGet(DWConstantXML, "/bookstore/book[2]/price/text()") | Will return 39.95.
This is the price element value within the second ([2]) book element. |
See also
This function relates to the Send HTTP Request task.