eXist-db に格納されている XML でクエリの応答を取得するために、Python で次のコードを実行しました。私は値を取得しますが、問題は以下の出力に示されているように「インスタント」タイプです。これが私のコードです:
from eulexistdb import db
class TestExist:
def __init__(self):
self.db = db.ExistDB("http://localhost:8899/exist/")
def get_res(self,query):
#result = list()
res = self.db.executeQuery(query)
hits = self.db.getHits(res)
for i in range(hits):
print self.db.retrieve(res,i)
print type(self.db.retrieve(res,i))
xquery = '''
let $x:= doc("/db/sample/books.xml")
return $x/bookstore/book/price/text()'''
a = TestExist()
a.get_res(xquery)
これでクエリは正常に機能し、結果も次のように出力されます。
30.00
<type 'instance'>
29.99
<type 'instance'>
49.99
<type 'instance'>
39.95
<type 'instance'>
私が望むのは、リスト「結果」に追加された値を返すことです。型変換を試みましたが失敗しました。どうすればこれを達成できますか?