Assume the following markup:
<html>
<body>
<p>
<strong> </strong>
<strong>
</strong>
<strong><em>Bar</em> </strong>
<strong><em> </em> </strong>
</p>
</body>
</html>
How can I get the following elements with a XPath query?
<strong> </strong>
<strong>
</strong>
<strong><em> </em> </strong>
I've thought it would something like //*[normalize-space(text()) = '' and not(node())]
for the first both cases but it's not. And I have no clue how to catch the third case.
To be more precisely: I'm searching for all nodes which contain only white space, new lines and child nodes with the same.
The following XPath query catches them all:
//*[not(normalize-space())]
But not:
<strong><em>Bar</em> </strong>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With