AnsweredAssumed Answered

How to count the number elements/tag present in one parent tag?

Question asked by akshay.b.goel892139 on Mar 22, 2018

Hi All,

 

How to count the number elements/tag present in one parent tag?

Foreg:

<CATALOG>
<CD>
<TITLE>Empire Burlesque</TITLE>
<ARTIST>Bob Dylan</ARTIST>
<COUNTRY>USA</COUNTRY>
<COMPANY>Columbia</COMPANY>
<PRICE>10.90</PRICE>
<YEAR>1985</YEAR>
</CD>
<ABCD>
<TITLE1>Hide your heart</TITLE1>
<ARTIST1>Bonnie Tyler</ARTIST1>
<COUNTRY1>UK</COUNTRY1>
<COMPANY1>CBS Records</COMPANY1>
<PRICE1>9.90</PRICE1>
<YEAR1>1988</YEAR1>
</ABCD>
</CATALOG>
So here specifically if I want to get the count of number elements present inside <CD> tag(Eg; 6 in this condition) or else if no child tag is present than the count should give me "0"
 

Outcomes