How do I select ALL nodes which have some value and are not empty? For example, I have the following XML:
<bbb>
<aaa/>
<bbb/>
<ccc>23</ccc>
<ddd/>
<eee>Health</eee>
<fff/>
</bbb>
Here I want to select those nodes which are children of bbb and have some value i.e. the nodes ccc and eee.
select those nodes which are children of bbb and have some value
If you want to include nodes that only contain whitespace, try:
/bbb/*[string()]
If you want to ignore nodes that only contain whitespace (<x> </x>
), try:
/bbb/*[normalize-space()]
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