Project

General

Profile

« Previous | Next » 

Revision 142

xpath.py: Refactored xml_func.py to avoid needing a doc parameter for the XML document

View differences:

xml_dom.py
108 108
def replace(old_node, new_node):
109 109
    old_node.parentNode.replaceChild(new_node, old_node) # note order reversed
110 110

  
111
def replace_with_text(doc, node, str_): replace(node, doc.createTextNode(str_))
111
def replace_with_text(node, str_):
112
    replace(node, node.ownerDocument.createTextNode(str_))
112 113

  
113 114
def by_tag_name(node, name, last_only=False):
114 115
    '''last_only optimization returns last matching node'''

Also available in: Unified diff