Example #1
0
def Node_appendChild(node, tmp):

    # Work around libxml2 tendency to merge text nodes and free nodes silently.

    if libxml2mod.type(tmp) == "text":
        placeholder = libxml2mod.xmlNewNode("tmp")
        placeholder = libxml2mod.xmlAddChild(node, placeholder)
        libxml2mod.xmlReplaceNode(placeholder, tmp)
        return tmp
    else:
        return libxml2mod.xmlAddChild(node, tmp)
Example #2
0
def Node_insertBefore(node, tmp, oldNode):

    # Work around libxml2 tendency to merge text nodes and free nodes silently.

    if libxml2mod.type(tmp) == "text":
        placeholder = libxml2mod.xmlNewNode("tmp")
        placeholder = libxml2mod.xmlAddPrevSibling(oldNode, placeholder)
        libxml2mod.xmlReplaceNode(placeholder, tmp)
        return tmp
    else:
        return libxml2mod.xmlAddPrevSibling(oldNode, tmp)
Example #3
0
def Node_replaceChild(node, tmp, oldNode):
    return libxml2mod.xmlReplaceNode(oldNode, tmp)
Example #4
0
def Node_replaceChild(node, tmp, oldNode):
    return libxml2mod.xmlReplaceNode(oldNode, tmp)