XPath : All divs which not have a specific child



I'm have HTML file and I'm parsing it with XPath. I'm want to select all [div] nodes which not have [p] tag(s) in it.


For example, input:



<div>
<p>no1</p>
</div>
<div>
<div>
<p>no2</p>
</div>
</div>
<div>
yes!!!
</div>


Expected output:



yes!!!


I'm tried this XPath query, which not working for me:



//div[not (p)]

No comments:

Post a Comment