...
Response Type | XPath Expression | Explanation |
---|---|---|
String | n/a | A String response should be referenced in the stream attribute expressions as in.value Note that in.value will contain the complete string data referenced above. |
XML | /root/main/h:title Note that the namspace prefix used here 'h' must be configured in the HTTP XML Namspaces form | This XPath expression will bring back all elements matching the xpath expression including the parent/grandparents and all child elements/subelements. i.e <root xmlns:h="http://www.w3.org/TR/html4/"> <main page="PF Main Page" > <h:title h:name="PF Title">PF Title Text <h:datarow> <h:data h:initials="AD">Ali Dawson</h:data> <h:data h:initials="GP">Gary Parden</h:data> </h:datarow> </h:title> </main> </root> The following examples show how to reference the returned xpaths html/xml data structure in stream attribute expressions:-
Note the use of a $ instead of our usual : namespace notation. Note the use of a ^ to traverse to the immediate parent element. Note the use of the listToString function to handle multiple matching child elements/attributes. |
HTML | /html/body/table Note that namspaces are not supported in the Xpath expression for HTML response types | This XPath expression will bring back all elements matching the xpath expression including the parent/grandparents and all child elements/subelements. i.e <html> <body nodename="Html Body"> <table> <tbody> <tr> <td initials="AD">Ali Dawson</td> <td initials="GP">Gary Parden</td> </tr> </tbody> </table> </body> </html> The following examples show how to reference the returned xpaths html/xml data structure in stream attribute expressions:-
Note the use of a ^ to traverse to the immediate parent element. Note the use of the listToString function to handle multiple matching child elements/attributes. Note the use of the optional html <tbody> tags. If these are not in your html data, then phixflow will insert them to conform with the HTML standards. Therefore when using absolute XPath expressions, note that the tbody tags need to be included even if they are not present in the incoming HTML data. |
...
Since this document uses a default namespace ("urn:xmlns:company-com:message"), to refer to any element in an XPath expression that does not explicitly use a namespace you must use the default namespace. So to extract all record elements, you must first define a namespace in the collector for the default namespace. Suppose that you do and give this the name def. Then the XPath (defined in the XPath field on the Response tab) to extract all record elements will be //def:record
...