I have the following HTML code
<html>
<body>
~~ optional text and variably-nested elements ~~
<div class="a">
~~ optional text and variably-nested elements ~~
<div class="b">example</div>
~~ optional text and variably-nested elements ~~
</div>
~~ optional text and variably-nested elements ~~
<div class="c">
~~ optional text and variably-nested elements ~~
<div class="b">example</div>
~~ optional text and variably-nested elements ~~
</div>
~~ optional text and variably-nested elements ~~
</body>
</html>
I would like to retrieve the <div class="b"> DOMNode of the <div class="c">.
I have used:
//*[@class='b']
but it produced wrong results. What would be the correct XPath query to use?
Thanks
Try with
http://codepad.org/EzBAWDPg