示例#1
0
文件: SQLTreeSink.py 项目: twdb/txhis
 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
示例#2
0
def getXMLcontent(result):
    parser = DOMParser()
    parser.reset()
    parser.parse(InputSource(result.inputStream))
    root = parser.getDocument().getDocumentElement()

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

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