示例#1
0
 def xpathQuery(self, txn, xpath):        
     xmlResult = [u'<?xml version="1.0"?><results>']
     
     files = os.listdir(self.dbPath)
     for file in files:
         doc = XMLFragment(open(self.dbPath + "/" + file).read())
         results = doc.xpathEval(xpath)
         for result in results:
             result.unlinkNode()
             result.reconciliateNs(doc.getDocument())
             content = result.serialize()
             if (content.startswith("<")):
                 xmlResult.append(content)
             else:
                 xmlResult.append(result.content)
                   
     xmlResult.append(u"</results>")
     
     #self._applyTriggers(txn, "query", XMLFragment("\n".join(xmlResult)))
     
     return u"\n".join(xmlResult)