Project

General

Profile

« Previous | Next » 

Revision 155

xpath.py: Added automatic conversion of strings to paths where needed.

View differences:

scripts/lib/xpath.py
219 219
    return parent
220 220

  
221 221
def put_obj(root, xpath, id_, has_types, value=None):
222
    if type(xpath) == str: xpath = parse(xpath)
223
    
222 224
    xpath = copy.deepcopy(xpath) # don't modify input!
223 225
    set_id(xpath, id_, has_types)
224 226
    if value != None: set_value(xpath, value)
......
229 231
    get(root, xpath, True)
230 232
    return root
231 233

  
232
def str2xml(xpath): return path2xml(parse(xpath))
233

  
234 234
def xml_set_id(root, id_): xml_dom.set_id(root.firstChild, id_)

Also available in: Unified diff