xpath find node that does not contain child

I'm trying to create some xpath that will find all a tags that do not contain img tags, so that something such as

<a href="http://aol.com">link</a>

matches, but

<a href="http://yahoo.com"><img src="http://yahoo.com/logo.png"></a>

does not.

Of course I could do this in a two-part search but I'm sure there must be some way to do this with xpath.

Answers


//a[not(img)]

Try and avoid the // if you can, though. Also note this will only exclude as that directly contain imgs.


Need Your Help

Is it possible to run a bash script from Maven?

bash maven

For creating configuration of my application I need to run bash script.

Registry vs. INI file for storing user configurable application settings

windows registry settings configuration-files ini

I'm a new Windows programmer and I'm not sure where I should store user configurable application settings. I understand the need to provide a user friendly means for the user to change application