Revision 1002
Added by Aaron Marcuse-Kubitza almost 13 years ago
lib/xpath.py | ||
---|---|---|
9 | 9 |
##### Path elements |
10 | 10 |
|
11 | 11 |
class XpathElem: |
12 |
def __init__(self, name, value=None, is_attr=False): |
|
12 |
def __init__(self, name='', value=None, is_attr=False):
|
|
13 | 13 |
if name == '': name = '.' |
14 | 14 |
self.name = name |
15 | 15 |
self.value = value |
... | ... | |
34 | 34 |
|
35 | 35 |
def __eq__(self, other): return self.__dict__ == other.__dict__ |
36 | 36 |
|
37 |
empty_elem = XpathElem() |
|
38 |
|
|
39 |
def elem_is_empty(elem): return elem == empty_elem |
|
40 |
|
|
37 | 41 |
##### Paths |
38 | 42 |
|
39 | 43 |
def is_positive(path): return path[0].is_positive |
Also available in: Unified diff
xpath.py: Added elem_is_empty()