Why not like this?
```
if (trim($node->nodeValue) !== '') {
```