Hi Günter,
sorry for my blatant ignorance, I am using RESTXQ over REST so regularly, that I almost forgot about the actual REST-Servlet!
Still I encourage you to go with fetch:xml(); so if you changed it from:
let $tokens := fetch:xml("tokens.xml")//entry
To:
let $tokens := fetch:xml(„relative/to/.basex-home/tokens.xml")//entry
With `fetch:xml` in contrast to `doc()` it should work consistently across all modes of operation (REST, RestXQ, BaseX Standalone).
See: http://docs.basex.org/wiki/Fetch_Module#Conventions http://docs.basex.org/wiki/Fetch_Module#Conventions And this GIST for resolving inconsistencies: https://gist.github.com/micheee/2baf385a1974c9da0db867ed2634cf48
I am not really sure when the behavior of `doc` in the REST servlet changed, but a commit between 8.5.4 and 8.6 must have introduced this change.
`RESTPATH` is used to define the location of the XQuery files ran via the `?run=`-Parameter, but it does not change the base uri of the static context.
Hope this won’t cause too much trouble with your codebase.
Best Michael
Btw. You are not the first one to encounter the intricacies of the doc() function: https://github.com/BaseXdb/basex/issues/1435 https://github.com/BaseXdb/basex/issues/1435
Am 04.09.2017 um 14:32 schrieb Günter Dunz-Wolff guenter.dunzwolff@gmail.com:
Hi Michael,
thanks for the information. I changed let $tokens := doc("tokens.xml")//entry to let $tokens := fetch:xml("tokens.xml")//entry (tokens.xml is in the same directory as the xq-file.)
The problem is still the same: [bxerr:BXFE0001] Resource "/Users/User/tokens.xml (No such file or directory)" not found.
The path should be: /Users/User/Documents/project/BaseXWeb/tokens.xml
Same problems with RESTPATH empty or path to project-folder.
As I wrote, I have only problems with the REST-Service, not with RESTXQ.
Best, Guenter