Project

General

Profile

« Previous | Next » 

Revision 1238

xpath.py: parse(): Added support for lookup-only elements which are not created if they don't exist

View differences:

lib/xpath.py
15 15
        self.value = value
16 16
        self.is_attr = is_attr
17 17
        self.is_positive = True
18
        self.is_lookup_only = False
18 19
        self.is_ptr = False
19 20
        self.keys = []
20 21
        self.attrs = []
......
26 27
        if self.is_attr: str_ += '@'
27 28
        if self.name == '': str_ += '""'
28 29
        else: str_ += self.name
30
        if self.is_lookup_only: str_ += '?'
29 31
        if self.keys != []: str_ += repr(self.keys)
30 32
        if self.attrs != []: str_ += ':'+repr(self.attrs)
31 33
        if self.is_ptr: str_ += '->'
......
107 109
            
108 110
            elem = XpathElem(is_attr=parser.str_('@'), name=_value())
109 111
            
112
            elem.is_lookup_only = parser.str_('?')
113
            
110 114
            # Keys used to match nodes
111 115
            if parser.str_('['):
112 116
                elem.keys = _paths()

Also available in: Unified diff