Reputation: 18629
I want to search for the child node that starts with "php"
<globals-cookie>
<utma>1.959760512.1318348214.1318348214.1318348214.1</utma>
<utmz>1.1318348214.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)</utmz>
<phpsessid34534>826427ef2fade7f9471581a429ce266d</phpsessid34534>
<utmb>122420241.88.10.1321257433</utmb>
<utmc>122420241</utmc>
</globals-cookie>
I would write //globals-cookie/phpsessid34534
, but the number changes on the end..
Upvotes: 2
Views: 366
Reputation: 6956
Firstly, the XPath to such a node as you describe would be:
/globals-cookie/*[starts-with(local-name(.),'php']
Secondly, this is what attributes are for - Something like this would be more sensible.
<php sessid="34534">826427ef2fade7f9471581a429ce266d</php>
Upvotes: 0
Reputation: 56202
You can use this XPath:
globals-cookie/*[starts-with(local-name(), 'php')]
Upvotes: 3