Using XQuery 3.1 with output methods adpative or json
Issues related to W3C XQuery.
-
- Posts: 102
- Joined: Tue Aug 19, 2014 12:04 pm
Using XQuery 3.1 with output methods adpative or json
Post by Martin Honnen »
Using the recent oXygen 21 release, I had hoped there is now a way to use XQuery 3.1 with any of the installed Saxon 9.8.0.12 engines (i.e. HE, PE, EE) to make use of XQuery 3.1 directives like
and then be able to have the result be serialized according the declared output method.
However, whatever I try, I either get some wrong result (for a simple arrray
) with "present as sequence" I get only the array items output as
instead of the
Saxon gives from the command line.
And when I try show result in editor I get an error
System ID: C:\SomePath\array-literal1.xq
Scenario: array-literal11
XQuery file: C:\SomePath\array-literal1.xq
Engine name: Saxon-HE XQuery 9.8.0.12
Severity: error
Description: Wrapped output: cannot display a function item
Is there some way to use the Saxon XQuery engines installed within oXygen 21 in a XQuery transformation scenario to have them use and apply the serialization methods "adapative" or "json" declared in the query code?
Code: Select all
declare namespace output = "http://www.w3.org/2010/xslt-xquery-serialization";
declare option output:method 'adaptive';
However, whatever I try, I either get some wrong result (for a simple arrray
Code: Select all
declare namespace output = "http://www.w3.org/2010/xslt-xquery-serialization";
declare option output:method 'adaptive';
[1, 2, 3, 4]
Code: Select all
1
2
3
4
Code: Select all
[1,2,3,4]
And when I try show result in editor I get an error
System ID: C:\SomePath\array-literal1.xq
Scenario: array-literal11
XQuery file: C:\SomePath\array-literal1.xq
Engine name: Saxon-HE XQuery 9.8.0.12
Severity: error
Description: Wrapped output: cannot display a function item
Is there some way to use the Saxon XQuery engines installed within oXygen 21 in a XQuery transformation scenario to have them use and apply the serialization methods "adapative" or "json" declared in the query code?
-
- Posts: 388
- Joined: Thu Jul 01, 2004 12:29 pm
Re: Using XQuery 3.1 with output methods adpative or json
Hello Martin,
The Saxon engine generates the output correctly, depending on the output method that you have specified in the XQuery file.
To display this result in Oxygen, you need to specify in the XQuery transformation scenario how you want to see the result. If you select "Present as sequence", the result is presented in the "Sequence" view as a serialization of the resulted nodes.
Therefore, you need to uncheck "Present as sequence" and select to save the result in a file (for example "output.json") and open the file in the editor. If you don't want to save the result in a file you can present it in the XML results view by selecting "Show in results view as XML". The result will be generated correctly depending on the output method, but the syntax highlight will be for XML documents.
Oxygen does not have a view to present the output depending on the method specified in the XQuery file, I will add an issue to improve this support.
Best Regards,
Octavian
The Saxon engine generates the output correctly, depending on the output method that you have specified in the XQuery file.
To display this result in Oxygen, you need to specify in the XQuery transformation scenario how you want to see the result. If you select "Present as sequence", the result is presented in the "Sequence" view as a serialization of the resulted nodes.
Therefore, you need to uncheck "Present as sequence" and select to save the result in a file (for example "output.json") and open the file in the editor. If you don't want to save the result in a file you can present it in the XML results view by selecting "Show in results view as XML". The result will be generated correctly depending on the output method, but the syntax highlight will be for XML documents.
Oxygen does not have a view to present the output depending on the method specified in the XQuery file, I will add an issue to improve this support.
Best Regards,
Octavian
Octavian Nadolu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 102
- Joined: Tue Aug 19, 2014 12:04 pm
Re: Using XQuery 3.1 with output methods adpative or json
Post by Martin Honnen »
Somehow I don't get it to work, even as you described it.
I have created a new project to test it with <oXygen/> XML Editor 21.0, build 2019022207, there I now have an XQuery file simply returning an array literal
and when executed with Saxon 9.8.0.12 HE XQuery and the output option "show in results view as XML" I only get an error
System ID: C:\SomePath\xquery\array-literal1.xq
Scenario: array-literal1
XQuery file: C:\SomePath\xquery\array-literal1.xq
Engine name: Saxon-HE XQuery 9.8.0.12
Severity: error
Description: Wrapped output: cannot display a function item
The other option to provide an output file name and have that opened in the editor also gives
System ID: C:\SomePath\xquery\array-literal1.xq
Scenario: array-literal1 to file
XQuery file: C:\SomePath\xquery\array-literal1.xq
Engine name: Saxon-HE XQuery 9.8.0.12
Severity: error
Description: Wrapped output: cannot display a function item
Any idea which setting could be wrong?
I have created a new project to test it with <oXygen/> XML Editor 21.0, build 2019022207, there I now have an XQuery file simply returning an array literal
Code: Select all
declare namespace map = "http://www.w3.org/2005/xpath-functions/map";
declare namespace array = "http://www.w3.org/2005/xpath-functions/array";
declare namespace output = "http://www.w3.org/2010/xslt-xquery-serialization";
declare option output:method 'adaptive';
[1, 2, 3, 4]
System ID: C:\SomePath\xquery\array-literal1.xq
Scenario: array-literal1
XQuery file: C:\SomePath\xquery\array-literal1.xq
Engine name: Saxon-HE XQuery 9.8.0.12
Severity: error
Description: Wrapped output: cannot display a function item
The other option to provide an output file name and have that opened in the editor also gives
System ID: C:\SomePath\xquery\array-literal1.xq
Scenario: array-literal1 to file
XQuery file: C:\SomePath\xquery\array-literal1.xq
Engine name: Saxon-HE XQuery 9.8.0.12
Severity: error
Description: Wrapped output: cannot display a function item
Any idea which setting could be wrong?
-
- Posts: 388
- Joined: Thu Jul 01, 2004 12:29 pm
Re: Using XQuery 3.1 with output methods adpative or json
Hi Martin,
The error seems to be generated because in the Options->Preferences-"XML / XSLT-XQuery / XQuery" options page you have the "Create structure indicating the type nodes" option set. Maybe we do not need to use this option when the output method is not xml.
Best Regards,
Octavian
The error seems to be generated because in the Options->Preferences-"XML / XSLT-XQuery / XQuery" options page you have the "Create structure indicating the type nodes" option set. Maybe we do not need to use this option when the output method is not xml.
Best Regards,
Octavian
Octavian Nadolu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service