XML2 - Find the Maximum Depth

  • + 0 comments
    maxdepth = 0
    def depth(elem, level):
        global maxdepth
        for child in elem:
            depth(child,level+1)
        maxdepth = max(maxdepth,level+1)
        return maxdepth