Project

General

Profile

« Previous | Next » 

Revision 1000

xpath.py: Added support for getting the parent node when encountering ".."

View differences:

lib/xpath.py
166 166
        child = root.getAttributeNode(elem.name)
167 167
        if child != None: children = [child]
168 168
    elif elem.name == '.': children = [root]
169
    elif elem.name == '..':
170
        parent = xml_dom.parent(root)
171
        if parent != None: children = [parent]
172
        else: return [] # don't try to create the document root's parent
169 173
    else:
170 174
        children = xml_dom.by_tag_name(root, elem.name,
171 175
        last_only and (elem.keys == [] or is_instance(elem)))

Also available in: Unified diff