daemon/core/misc/xmlutils.py
def iterDescendants(dom, max_depth = 0):
    '''\
    Iterate over all descendant element nodes in breadth first order.
    Only consider nodes up to max_depth deep when max_depth is greater
    than zero.
    '''
    nodes = [dom]
    depth = 0
    current_depth_nodes = 1
    next_depth_nodes = 0
    while nodes:
        n = nodes.pop(0)
        for child in n.childNodes:
            if child.nodeType == Node.ELEMENT_NODE:
                yield child
                nodes.append(child)
                next_depth_nodes += 1
        current_depth_nodes -= 1
        if current_depth_nodes == 0:
            depth += 1
            if max_depth > 0 and depth == max_depth:
                return
            current_depth_nodes = next_depth_nodes
            next_depth_nodes = 0
\
    Iterate over all descendant element nodes in breadth first order.
    Only consider nodes up to max_depth deep when max_depth is greater
    than zero.
    
\
Iterate over all descendant element nodes in breadth first order.
Only consider nodes up to max_depth deep when max_depth is greater
than zero.
\ Iterate over all descendant element nodes in breadth first order . Only consider nodes up to max_depth deep when max_depth is greater than zero .
def iterDescendants(dom, max_depth = 0):
    nodes = [dom]
    depth = 0
    current_depth_nodes = 1
    next_depth_nodes = 0
    while nodes:
        n = nodes.pop(0)
        for child in n.childNodes:
            if child.nodeType == Node.ELEMENT_NODE:
                yield child
                nodes.append(child)
                next_depth_nodes += 1
        current_depth_nodes -= 1
        if current_depth_nodes == 0:
            depth += 1
            if max_depth > 0 and depth == max_depth:
                return
            current_depth_nodes = next_depth_nodes
            next_depth_nodes = 0
def iterDescendants ( dom , max_depth = 0 ) : nodes = [ dom ] depth = 0 current_depth_nodes = 1 next_depth_nodes = 0 while nodes : n = nodes . pop ( 0 ) for child in n . childNodes : if child . nodeType == Node . ELEMENT_NODE : yield child nodes . append ( child ) next_depth_nodes += 1 current_depth_nodes -= 1 if current_depth_nodes == 0 : depth += 1 if max_depth > 0 and depth == max_depth : return current_depth_nodes = next_depth_nodes next_depth_nodes = 0
\
Iterate over all descendant element nodes in breadth first order.
\ Iterate over all descendant element nodes in breadth first order .
'''\
    Iterate over all descendant element nodes in breadth first order.
    Only consider nodes up to max_depth deep when max_depth is greater
    than zero.
    '''
dom
max_depth