예제 #1
0
def simplify_pif(odoc, pifs, ndoc, parent):
    for pif in pifs.childNodes:
        l1 = pif.childNodes
        element = ndoc.createElement('Network')
        parent.appendChild(element)
        for node in l1:
            if node.nodeName == 'network':
                element.setAttribute('name', node.getAttribute('name'))
                for subnode in node.childNodes:
                    child = ndoc.createElement(subnode.nodeName)
                    element.appendChild(child)
                    content = ndoc.createTextNode(
                        myutils.toString(subnode.firstChild.nodeValue))
                    child.appendChild(content)
            else:
                child = ndoc.createElement(node.nodeName)
                element.appendChild(child)
                content = ndoc.createTextNode(
                    myutils.toString(node.firstChild.nodeValue))
                child.appendChild(content)
예제 #2
0
def simplify_pbd(odoc, pbds, ndoc, parent):
    for pbd in pbds.childNodes:
        l1 = pbd.firstChild
        if len(l1.childNodes) == 0:
            continue
        node = l1.firstChild
        element = ndoc.createElement('PBD')
        parent.appendChild(element)
        content = ndoc.createTextNode(
            myutils.toString(node.firstChild.nodeValue))
        element.appendChild(content)