Example #1
0
    def parseWorkflowXML( self, xml, encoding=None ):

        """ Pseudo API.
        """
        dom = domParseString( xml )

        root = dom.getElementsByTagName( 'dc-workflow' )[ 0 ]

        workflow_id = _getNodeAttribute( root, 'workflow_id', encoding )
        title = _getNodeAttribute( root, 'title', encoding )
        state_variable = _getNodeAttribute( root, 'state_variable', encoding )
        initial_state = _getNodeAttribute( root, 'initial_state', encoding )

        states = _extractStateNodes( root, encoding )
        transitions = _extractTransitionNodes( root, encoding )
        variables = _extractVariableNodes( root, encoding )
        worklists = _extractWorklistNodes( root, encoding )
        permissions = _extractPermissionNodes( root, encoding )
        scripts = _extractScriptNodes( root, encoding )

        return ( workflow_id
               , title
               , state_variable
               , initial_state
               , states
               , transitions
               , variables
               , worklists
               , permissions
               , scripts
               )
Example #2
0
    def parseXML( self, xml, encoding=None ):

        """ Pseudo API.
        """
        dom = domParseString(xml)

        return _extractRolemapNode(dom, encoding)
Example #3
0
    def parseTypeXML( self, xml, encoding=None ):

        """ Pseudo API.
        """
        dom = domParseString(xml)

        return _extractTypeInfoNode(dom, encoding)
Example #4
0
    def parseWorkflowXML( self, xml, encoding=None ):

        """ Pseudo API.
        """
        dom = domParseString( xml )

        root = dom.getElementsByTagName( 'dc-workflow' )[ 0 ]

        workflow_id = _getNodeAttribute( root, 'workflow_id', encoding )
        title = _getNodeAttribute( root, 'title', encoding )
        state_variable = _getNodeAttribute( root, 'state_variable', encoding )
        initial_state = _getNodeAttribute( root, 'initial_state', encoding )

        states = _extractStateNodes( root )
        transitions = _extractTransitionNodes( root )
        variables = _extractVariableNodes( root )
        worklists = _extractWorklistNodes( root )
        permissions = _extractPermissionNodes( root )
        scripts = _extractScriptNodes( root )

        return ( workflow_id
               , title
               , state_variable
               , initial_state
               , states
               , transitions
               , variables
               , worklists
               , permissions
               , scripts
               )
Example #5
0
    def process_document(self, session, doc):
        # Take xml wrapper and convert onto object
        # Strip out SAX events first

        data = doc.get_raw()

        # Strip out sax to list
        saxre = re.compile("<c3:saxEvents>(.+)</c3:saxEvents>", re.S)
        match = saxre.search(data)
        data = saxre.sub("", data)
        elemHash = {}
        if match:
            sax = match.groups(1)[0]
            sax = sax.split("\n")
            # Now check if last is an element hash
            if sax[-1][:5] == "#hash":
                elemHash = eval(sax[-1][6:])
                sax = sax[:-1]
        else:
            sax = []
        
        # Now parse the rest of it and build Record
        rec = SaxRecord(sax)
        rec.elementHash = elemHash
        dom = domParseString(data)
        for c in dom.childNodes[0].childNodes:
            if c.nodeType == elementType:
                if (c.localName == "id"):
                    rec.id = flattenTexts(c)
                    if (rec.id.isdigit()):
                        rec.id = int(rec.id)
                elif (c.localName == "baseUri"):
                    rec.baseUri = flattenTexts(c)
                elif (c.localName == "schema"):
                    rec.schema = flattenTexts(c)
                elif (c.localName == "schemaType"):
                    rec.schemaType = flattenTexts(c)
                elif (c.localName == "size"):
                    rec.size = int(flattenTexts(c))
                elif (c.localName == "technicalRights"):
                    for c2 in c.childNodes:
                        if (c2.nodeType == elementType):
                            entry = (flattenTexts(c2), c2.localName, c2.getAttribute('role'))
                            rec.rights.append(entry)
                elif (c.localName == "history"):
                    for c2 in c.childNodes:
                        if (c2.nodeType == elementType):
                            # A modification
                            entry = ['', '', c2.getAttribute('type')]
                            for c3 in c2.childNodes:
                                if (c3.nodeType == elementType):
                                    if (c3.localName == "agent"):
                                        entry[0] = flattenTexts(c3)
                                    elif (c3.localName == "date"):
                                        entry[1] = flattenTexts(c3)
                            rec.history.append(entry)
        
        return rec
Example #6
0
 def process_document(self, session, doc):
     xml = doc.get_raw(session)
     try:
         dom = domParseString(xml)
     except ExpatError as e:
         raise XMLSyntaxError(e.message)
     rec = MinidomRecord(dom, xml)
     self._copyData(doc, rec)
     return rec
Example #7
0
 def process_document(self, session, doc):
     xml = doc.get_raw(session)
     try:
         dom = domParseString(xml)
     except ExpatError as e:
         raise XMLSyntaxError(e.message)
     rec = MinidomRecord(dom, xml)
     self._copyData(doc, rec)
     return rec
Example #8
0
    def parseXML(self, xml):
        """ Pseudo API.
        """
        reader = getattr(xml, 'read', None)

        if reader is not None:
            xml = reader()

        dom = domParseString(xml)
        root = dom.documentElement

        return self._extractNode(root)
Example #9
0
    def parseXML(self, xml):
        """ Pseudo API.
        """
        reader = getattr(xml, 'read', None)

        if reader is not None:
            xml = reader()

        dom = domParseString(xml)
        root = dom.documentElement

        return self._extractNode(root)
Example #10
0
    def parseXML(self, text, encoding=None):
        """ Pseudo API.
        """
        reader = getattr(text, 'read', None)

        if reader is not None:
            text = reader()

        dom = domParseString(text)

        root = dom.getElementsByTagName('actions-tool')[0]
        return _extractActionProviderNodes(root, encoding)
Example #11
0
    def parseXML( self, text, encoding=None ):

        """ Pseudo API.
        """
        reader = getattr( text, 'read', None )

        if reader is not None:
            text = reader()

        dom = domParseString(text)

        root = dom.getElementsByTagName('actions-tool')[0]
        return _extractActionProviderNodes(root, encoding)
Example #12
0
 def process_document(self, session, doc):
     xml = doc.get_raw(session)
     dom = domParseString(xml)
     rec = MinidomRecord(dom, xml)
     self._copyData(doc, rec)
     return rec
Example #13
0
    def parseXML(self, xml, encoding=None):
        """ Pseudo API.
        """
        dom = domParseString(xml)

        return _extractRolemapNode(dom, encoding)
Example #14
0
 def process_document(self, session, doc):
     xml = doc.get_raw()
     dom = domParseString(xml)
     rec = DomRecord(dom, xml)
     return rec
Example #15
0
 def process_document(self, session, doc):
     xml = doc.get_raw(session)
     dom = domParseString(xml)
     rec = MinidomRecord(dom, xml)
     self._copyData(doc, rec)
     return rec
Example #16
0
    def parseTypeXML(self, xml, encoding=None):
        """ Pseudo API.
        """
        dom = domParseString(xml)

        return _extractTypeInfoNode(dom, encoding)