Forums » Saxon/C Help and Discussions »
Still not possible with Python and SaxonC 11.2 to return an XDM array from XPath to Python?
Added by Martin Honnen almost 3 years ago
My code to return an XDM array from XPath to Python still fails with SaxonC 11.2 HE and Python 3:
from saxonc import *
with PySaxonProcessor(license=False) as proc:
print("Test SaxonC on Python")
print(proc.version)
xpath_processor = proc.new_xpath_processor()
result = xpath_processor.evaluate_single('array { random-number-generator(current-dateTime())?permute(1 to 10) }')
if (xpath_processor.exception_occurred):
print(xpath_processor.error_message)
print(result)
resultAsList = result.head.as_list()
print(resultAsList)
gives
Test SaxonC on Python
SaxonC-HE 11.2 from Saxonica
None
Traceback (most recent call last):
File "returnXdmArrayFromXPathTest1.py", line 16, in <module>
resultAsList = result.head.as_list()
AttributeError: 'NoneType' object has no attribute 'head'
so no error is given for the XPath evaluation but nothing (None
) is returned as the value.
Replies (2)
RE: Still not possible with Python and SaxonC 11.2 to return an XDM array from XPath to Python? - Added by O'Neil Delpratt over 2 years ago
The C++ API is returning the correct XdmArray object but the Python API is not handling this type.
RE: Still not possible with Python and SaxonC 11.2 to return an XDM array from XPath to Python? - Added by O'Neil Delpratt over 2 years ago
Bug issue created #5349
Please register to reply