Edit: the issue in my case was caused by a tool that doesn't fully implement the XPath standard. My attempt with
//key@
should have worked (see comments & answer), and the reason it doesn't work is that the tool only shows the first result.
My XML looks like this:
<Document id="someIdhere" token="123-456-789" created-by="john_doe" created-at="2020-05-27T10:04:28.244+0000" last-modified-by="jane_doe" last-modified-at="2020-07-30T09:27:59.440+0000">
<somedata/>
<somemoredata/>
<entries>
<entry key="resourceName">resourceLocation</entry>
<entry key="foo">bar</entry>
<entry key="somekey">somevalue</entry>
<entry key="keyname">keyvalue</entry>
<entry key="keyname1">value1</entry>
</entries>
<encryptedEntries/>
</Document>
I am looking to get the values of all key
attributes (so 'resourcename','foo', etc) ; not the value of the <entry>
nodes. There is no way in advance for me to know how many entries there will be, nor what the contents will be.
I have tried the following:
//@*
-> gives all attributes, not only the key
//entries/@*
-> returns nothing
//entry@*
-> returns nothing
//@key
-> returns only the first result
//entries/key[*]
-> returns nothing
//entry@key
-> returns nothing
//entry@key=*
-> returns nothing
I probably tried others as well, but these are what I can remember. If it makes any difference: the XPath is executed by the 'XML Webhook' task in Xebialabs' XLRelease.