Bug #4366
closedReturning string of Maps in XQuery failing
100%
Description
Reported by user in the forum post: https://saxonica.plan.io/boards/4/topics/7645
Due to the lack of support of XdmFunctionItem objects in Saxon/C it should be possible to execute in XQuery to string a map object but this fails.
The following python script supplied by the user we add to our unit tests for investigation purposes:
import saxonc
with saxonc.PySaxonProcessor(license=False) as proc:
print(proc.version)
xquery_processor = proc.new_xquery_processor()
query = """declare namespace output = "http://www.w3.org/2010/xslt-xquery-serialization";
declare option output:method 'json';
map { 'prop1' : 'value 1', 'prop2' : 'value 2' }"""
xquery_processor.set_property("!method", "json")
result = xquery_processor.run_query_to_string(query_text = query)
print("string result: ", result)
result = xquery_processor.run_query_to_value(query_text = query)
print("value result: ", result)
Outputs:
Saxon/C 1.2.1 running with Saxon-HE 9.9.1.5J from Saxonica
string result: None
value result: None
The equivalent works fine in XSLT. When returning a value object this should in fact not be possible. An error message should be reported to the user stating that "FunctionItem found. Currently not be handled"
Related issues
Updated by O'Neil Delpratt about 5 years ago
- Related to Bug #4365: XdmFunctionItem not supported added
Updated by O'Neil Delpratt about 5 years ago
- Status changed from New to In Progress
Update:
After some investigation the query is failing due to the Java API for Saxon/C not handling correctly the output properties supplied by the user. It is actually overwriting it with method=xml. As a workaround the XPath and XSLT APIs should work for serialising maps to string.
Updated by O'Neil Delpratt about 5 years ago
- Status changed from In Progress to Resolved
- % Done changed from 0 to 100
- Found in version set to 1.2.1
Bug fixed in the net.sf.saxon.option.cpp.XQueryEngine class. Fix available in the next maintenance release.
Updated by O'Neil Delpratt almost 3 years ago
- Fixed in version set to 11.1
Bug fix patched in SaxonC 11.1 release
Updated by O'Neil Delpratt almost 3 years ago
- Status changed from Resolved to Closed
Bug fix patched in SaxonC 11.1 release
Please register to edit this issue