Reputation: 85
I have a XML need to get the count of occurrences of an element
<lines>
<line>
<accountings>
<accounting>
<account>
<seg1>value1</seg2>
</account>
</accounting>
<accounting>
<account>
<seg1>value2</seg2>
</account>
</accounting>
</accountings>
</line>
<line>
<accountings>
<accounting>
<account>
<seg1>value3</seg2>
</account>
</accounting>
</accountings>
</line>
<line>
<account>
<seg1>value4</seg1>
</account>
</line>
</lines>
In the Above xml there are total 4 <account>
elements
I need the output as 4, but whenever I try for-each or for-each-group and count on each iterate I get value as 1111, atleast I need a way to add all the counts.
Upvotes: 2
Views: 1021