For this xml file :
<ROOT>
<A>
<B>2</B>
<C>3</C>
<D>
<E>12</E>
</D>
<F/>
<G/>
</A>
</ROOT>
How could I get the number of node like B and C, in which there is a value but no children ?
In this case , the number should be 2.
If you know which certain node you want (most the time you know) I prefer using XPath for selecting nodes (less coding).
Consider this short sample: