Revision 757
Added by Aaron Marcuse-Kubitza almost 13 years ago
lib/xml_dom.py | ||
---|---|---|
156 | 156 |
def replace(old_node, new_node): |
157 | 157 |
old_node.parentNode.replaceChild(new_node, old_node) # note order reversed |
158 | 158 |
|
159 |
def replace_with_text(node, str_): |
|
160 |
replace(node, node.ownerDocument.createTextNode(str_)) |
|
159 |
def replace_with_text(node, new): |
|
160 |
if isinstance(new, basestring): new = node.ownerDocument.createTextNode(new) |
|
161 |
replace(node, new) |
|
161 | 162 |
|
162 | 163 |
##### |
163 | 164 |
|
Also available in: Unified diff
xml_dom.py: replace_with_text(): Accept Node inputs for cases where e.g. an XML func with an error has been replaced with a comment