Hello,
XQuery is a lovely language and together with BaseX it is very lovely.
But now, for a project that need Python, I find difficulties understanding the general workflow communicating between BaseX and Python.
My basic situation boils down to 1) execute a query on BaseX that returns a list of data 2) analyse every item in the in Python 3) push the analysis result back in to BaseX.
I have done updates like this solely in XQuery but this time I need the analysis part done in Python.
Since I seem to only get a list of strings out of a query executed by the client, is this usecase even possible?
Below is attached my sample running code
Best regards, Kristian K
```Python from BaseXClient import BaseXClient
# open a session session = BaseXClient.Session('localhost', 1984, 'admin', 'admin')
# execute a query that returns a list of entry elements query = session.query(""" let $list := <list> <entry> <a>1</a> <b>2</b> </entry> <entry> <a>1</a> <b>2</b> <c>3</c> </entry> </list>
let $items := for $entry in $list/entry[not(exists(./c))] return $entry
return $items """ )
# process each item of the query for typecode, item in query.iter(): print(type(item)) print(item)
session.close() ```
This returns simply: <class 'str'> # the type of returned item is of class 'str' <entry> # this is the content of the plain text object <a>1</a> <b>2</b> </entry>