XML2 - Find the Maximum Depth

  • + 0 comments
    1. def depth(elem, level):
    2. lev = level+1
    3. global maxdepth
    4. if lev > maxdepth:
    5. maxdepth = lev
    6. for child in elem:
    7. depth(child,level+1)