Revision 2558
Added by Aaron Marcuse-Kubitza over 12 years ago
xml_func.py | ||
---|---|---|
194 | 194 |
except KeyError, e: raise SyntaxError(e) |
195 | 195 |
value = items.get('value', None) |
196 | 196 |
|
197 |
required_node = xpath.get_1(value, require, allow_rooted=False) |
|
198 |
if required_node == None or xml_dom.is_empty(required_node): return None |
|
197 |
if xpath.get_value(value, require, allow_rooted=False) == None: return None |
|
199 | 198 |
else: return value |
200 | 199 |
funcs['_collapse'] = _collapse |
201 | 200 |
|
... | ... | |
444 | 443 |
node = root |
445 | 444 |
while node != None: |
446 | 445 |
new_node = xpath.get_1(node, next, allow_rooted=False) |
447 |
required_node = xpath.get_1(node, require, allow_rooted=False) |
|
448 |
if required_node == None or xml_dom.is_empty(required_node):# empty elem |
|
446 |
if xpath.get_value(node, require, allow_rooted=False) == None: # empty |
|
449 | 447 |
xml_dom.replace(node, new_node) # remove current elem |
450 | 448 |
if node is root: root = new_node # also update root |
451 | 449 |
node = new_node |
Also available in: Unified diff
xml_func.py: Replaced xpath.get_1() with xpath.get_value() where possible, for simplicity