i am creating an html code using text editor , but after creating the code i need to perform some actions on all sub childs (i.e tags). For that i need to know the number of levels of all the childs.
<p>
  <span style="font-size: 12pt;">
     <span style="font-family: arial, helvetica, sans-serif;">
         Sales 
     </span>
     Offer 
     <span style="background-color: #33cccc;">
        20
        <span style="background-color: #ff9900;">
           %
        </span>
     </span> 
     Off This Week
   </span>
</p> 
in short i need to count all deep levels of childs of
tag.
 
    