Beispiel #1
0
 def process(self):
     'Get the next message to be processed or return that sources are dry'
     self.msg = ''
     self.tmpMsg = StringIO.StringIO()
     try:
         parser = DOMParser( )
         parser.parse(InputSource(java.io.StringReader(self.InMsg)))
         XMLStream = parser.getDocument()
         print "message parsed ok" 
         
         resultNodeList = self.xpath.selectNodeList(XMLStream,'/*/' + self.treeQ['request']['recTag'])
         for i in range(resultNodeList.getLength()):
             currentTag = resultNodeList.item(i)
             print "query 1"
             fieldList = self.xpath.selectNodeList(currentTag,'*')
             query = self.treeQ['request']['SQL']
             (generatedId, modQuery) = self.prepareInsert(query, fieldList)
             print "Generated query : "  + str(modQuery)
             self.executeQuery(modQuery)
             for nextQuery in self.treeQ['request']['nextRequests']:
                 print "next query" 
                 self.processQuery(nextQuery, generatedId, currentTag)
                 
         return 0
         
     except:
         errorMessage = traceback.format_exception_only(sys.exc_info()[0],sys.exc_info()[1])[0]
         reticLog.logError(self.logList, '(' + self.name + ') ' + "Error during message processing" )                        
         reticLog.logError(self.logList, '(' + self.name + ') ' + errorMessage)
         return 1
Beispiel #2
0
def getXMLcontent(result):
    parser = DOMParser()
    parser.reset()
    parser.parse(InputSource(result.inputStream))
    root = parser.getDocument().getDocumentElement()

    return root
Beispiel #3
0
def getXMLcontent(result):
  parser = DOMParser()
  parser.reset()
  parser.parse(InputSource(result.inputStream))
  root = parser.getDocument().getDocumentElement()
    
  return root
Beispiel #4
0
 def _parse_from_source(self, source):
     from org.apache.xerces.parsers import DOMParser
     p = DOMParser()
     p.parse(source)
     return Document(p.getDocument())
Beispiel #5
0
    def _parse_from_source(self, source):
        from org.apache.xerces.parsers import DOMParser

        p = DOMParser()
        p.parse(source)
        return Document(p.getDocument())