Project

General

Profile

« Previous | Next » 

Revision 143

Refactored xml_dom.set_value() to avoid needing a doc parameter for the XML document

View differences:

xml_dom.py
78 78
    if node.firstChild != None: return node.firstChild.nodeValue
79 79
    else: return node.nodeValue
80 80

  
81
def set_value(doc, node, value):
81
def set_value(node, value):
82 82
    if node.nodeType == Node.ELEMENT_NODE:
83
        node.appendChild(doc.createTextNode(value))
83
        node.appendChild(node.ownerDocument.createTextNode(value))
84 84
    else: node.nodeValue = value
85 85

  
86 86
class NodeTextEntryIter:
......
102 102
def set_child(node, name, value):
103 103
    '''Note: does not remove any existing child of the same name'''
104 104
    child = node.ownerDocument.createElement(name)
105
    set_value(node.ownerDocument, child, value)
105
    set_value(child, value)
106 106
    node.appendChild(child)
107 107

  
108 108
def replace(old_node, new_node):

Also available in: Unified diff