Exemplo n.º 1
0
    def readChild(self, child):
        elementType = self.getElementType(child.tag)
        elementClass = ProcessList.getClass(elementType)
        #print( elementType, elementClass )

        if elementClass != None:
            element = elementClass()
            element.read(child)

            processNodeClass = ProcessList.getClass("ProcessNode")
            if issubclass(elementClass, processNodeClass):
                self.addProcess( element )
            else:
                self.addElement( element )
        else:
            print( "Group::read - Ignoring element : %s" % child.tag)

        return None
Exemplo n.º 2
0
    def readChild(self, child):
        elementType = child.tag.replace('-', '')
        elementType = child.tag.replace('_', '')
        elementClass = ProcessList.getClass(elementType)
        #print( elementType, elementClass )

        if elementClass != None:
            element = elementClass()
            element.read(child)

            processNodeClass = ProcessList.getClass("ProcessNode")
            if issubclass(elementClass, processNodeClass):
                self.addProcess( element )
            else:
                self.addElement( element )
        else:
            print( "Group::read - Ignoring element : %s" % child.tag)

        return None
Exemplo n.º 3
0
    def write(self, tree, writeSelfContained=False):
        node = ProcessNode.write(self, tree)

        # Add ProcessNode elements
        for process in self._processes:
            # Choose whether to write Reference node or nodes referred to
            if isinstance(process, ProcessList.getClass("Reference")):
                process.setWriteReferencedNodes(writeSelfContained)
            process.write(node)
        
        return node
Exemplo n.º 4
0
    def write(self, tree, writeSelfContained=False):
        node = ProcessNode.write(self, tree)

        # Add ProcessNode elements
        for process in self._processes:
            # Choose whether to write Reference node or nodes referred to
            if isinstance(process, ProcessList.getClass("Reference")):
                process.setWriteReferencedNodes(writeSelfContained)
            process.write(node)
        
        return node