I want to mach (in real case I use DomDocument php) a link inside:
Case:
<div class="d1">
<span class="s1">
<a class="myclass">my link</a>
</span>
</div>
My solution that fail:
'//div[@class="d1"]/span[@class="s1"]/a[@class="myclass"]'
what should i change in my xpath expression?
Edit:
In real case I have in middle of div before span also other tags.
Soo I solve the problem by add / before span :
'//div[@class="d1"]//span[@class="s1"]/a[@class="myclass"]'
Thanks
Your XPath seems to be correct. Probably you are trying to query an XHTML document? Then you have to mind the XHTML namepace:
just an idea…