Project

General

Profile

« Previous | Next » 

Revision 2004

xpath.py: put_obj(): Return a tuple of the inserted node and the id attr node

View differences:

lib/xpath.py
334 334
    return util.do_ignore_none(xml_dom.value, get_1(*args, **kw_args))
335 335

  
336 336
def put_obj(root, xpath, id_, has_types, value=None):
337
    '''@return tuple(inserted_node, id_attr_node)'''
337 338
    if util.is_str(xpath): xpath = parse(xpath)
338 339
    
339 340
    xpath = xpath[:] # don't modify input!
340
    set_id(xpath, id_, has_types)
341
    id_path = set_id(xpath, id_, has_types)
341 342
    if value != None: set_value(xpath, value)
342
    return get(root, xpath, True)
343
    return (get(root, xpath, True), get(root, id_path))
343 344

  
344 345
def path2xml(xpath, first_branch=True):
345 346
    root = xml_dom.create_doc().documentElement

Also available in: Unified diff