Project

General

Profile

« Previous | Next » 

Revision 2006

xml_func.py: _simplifyPath: Also treat the elem as empty if the required node exists but is empty

View differences:

lib/xml_func.py
387 387
    node = root
388 388
    while node != None:
389 389
        new_node = xpath.get_1(node, next, allow_rooted=False)
390
        if xpath.get_1(node, require, allow_rooted=False) == None: # empty elem
390
        required_node = xpath.get_1(node, require, allow_rooted=False)
391
        if required_node == None or xml_dom.is_empty(required_node):# empty elem
391 392
            xml_dom.replace(node, new_node) # remove current elem
392 393
            if node is root: root = new_node # also update root
393 394
        node = new_node

Also available in: Unified diff