Reputation: 95
Given the following SOAP XML response:
http://pastebin.com/f57T8ctD (too large to display in here)
If I try to retrieve the nodes <ssr>
with the next Xpath sentence:
//*[name() = 'ssr'][1]
What I am getting is the next:
<ssr xmlns="http://xml.amadeus.com/PNRACC_14_1_1A">
<type>CTCE</type>
<status>HK</status>
<quantity>1</quantity>
<companyId>OU</companyId>
<freeText>XXX//GMAIL.COM</freeText>
</ssr>
<ssr xmlns="http://xml.amadeus.com/PNRACC_14_1_1A">
<type>CTCM</type>
<status>HK</status>
<quantity>1</quantity>
<companyId>OU</companyId>
<freeText>XXX/SI</freeText>
</ssr>
Instead of only the first one as I have tried to select with the query.
Is there another way to select the different <ssr>
nodes specifying the node number?
Upvotes: 1
Views: 36
Reputation: 89315
Use brackets wrapping the entire XPath except the index :
(//*[name() = 'ssr'])[1]
See the following post for explanation : How to select specified node within Xpath node sets by index with Selenium?
Upvotes: 2