Hi Daniel,
… but what the pass option does is not clear to me. Definitely not passing the type error here.
I have slightly updated the comment in our documentation. By default, the option is false. If an error is raised, the line/column number and the optional file uri will refer to the location of the function call. If the option is enabled, the line/column and file uri will be adopted from the raised error. See the following example:
(: main.xq :) let $query := 'sub.xq' let $options := map { 'pass': false() } return xquery:parse-uri($query, $options)
(: sub.xq :) 1 2
The function raises the following error:
Stopped at main.xq, 3/24: [XPST0003] Unexpected end of query: '2'.
If pass is enabled, the feedback is:
Stopped at sub.xq, 1/4: [XPST0003] Unexpected end of query: '2'.
Hope this helps, Christian
[1] http://docs.basex.org/wiki/XQuery_Module#XQuery_Parsing
If you only need to catch the error message without the query plan, there’s always try/catch of course.
Best, Daniel
Von: Peter Villadsen Peter.Villadsen@microsoft.com Gesendet: Mittwoch, 13. November 2019 00:36 An: basex-talk@mailman.uni-konstanz.de Betreff: [basex-talk] Is there an API that provides XQuery compilation results?
When I use the GUI application I can see some error description (even if it a little terse) when my queries are incorrect. For instance I might get:
Stopped at tableFields.xq, 27/50:
[XQST0118] Different start and end tag: <Artifact>...</Artiact>.
If I submit a query like <Artifact></Artiact>
However, I cannot seem to find an API that brings me that information? I tried:
xquery:parse("<B></C>", map {'pass':true()})
but that did not get the result I expected. Also, while we’re at at it, it would be nice to also get the optimized query.
Best Regards
Peter Villadsen
Principal Architect
Microsoft Business Applications Group