Revision 3796
Added by Aaron Marcuse-Kubitza over 12 years ago
xpath.py | ||
---|---|---|
253 | 253 |
# Retrieve elem value |
254 | 254 |
value_ = elem.value |
255 | 255 |
if util.is_list(value_): # reference (different from a pointer) |
256 |
targets = get(root, value_)
|
|
257 |
try: target = targets[0]
|
|
258 |
except IndexError:
|
|
256 |
target = get_1(root, value_)
|
|
257 |
if target != None: value_ = xml_dom.value(target)
|
|
258 |
else:
|
|
259 | 259 |
warnings.warn(UserWarning('XPath reference target missing: ' |
260 | 260 |
+str(value_)+'\nXPath: '+str(xpath))) |
261 | 261 |
value_ = None |
262 |
else: value_ = xml_dom.value(target) |
|
263 | 262 |
|
264 | 263 |
# Check each match |
265 | 264 |
nodes = [] |
Also available in: Unified diff
xpath.py: get(): reference expansion: Use get_1() and check for None result instead of using get(), which returns multiple nodes when we just want the first