Project

Profile

Help

Bug #4366

closed

Returning string of Maps in XQuery failing

Added by O'Neil Delpratt over 4 years ago. Updated over 2 years ago.

Status:
Closed
Priority:
Normal
Category:
Saxon-C Internals
Start date:
2019-10-29
Due date:
% Done:

100%

Estimated time:
Found in version:
1.2.1
Fixed in version:
11.1
Platforms:

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

Related to SaxonC - Bug #4365: XdmFunctionItem not supportedClosedO'Neil Delpratt2019-10-29

Actions
Actions #1

Updated by O'Neil Delpratt over 4 years ago

  • Related to Bug #4365: XdmFunctionItem not supported added
Actions #2

Updated by O'Neil Delpratt over 4 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.

Actions #3

Updated by O'Neil Delpratt over 4 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.

Actions #4

Updated by O'Neil Delpratt over 2 years ago

  • Fixed in version set to 11.1

Bug fix patched in SaxonC 11.1 release

Actions #5

Updated by O'Neil Delpratt over 2 years ago

  • Status changed from Resolved to Closed

Bug fix patched in SaxonC 11.1 release

Please register to edit this issue

Also available in: Atom PDF