Page 1 of 1

XQuery Validation problem with imported modules

Posted: Wed Jan 06, 2010 9:01 pm
by joewiz
I am having problems validating XQuery files stored in eXist, if the XQuery file imports an XQuery module via a relative path. I believe this is an oXygen issue, not an eXist issue.

If I use a relative path, I can only get a red light during validation, not a green light. For example, this will give me a red light:

Code: Select all

import module namespace myns="http://mysite.com/myns" at "modules/mymodule.xqm";
The only way that oXygen will validate and give me the green light is if I provide an absolute URI, e.g.:

Code: Select all

import module namespace myns="http://mysite.com/myns" at "xmldb:exist:///db/site/modules/mymodule.xqm";
Wolfgang Meier (the creator of eXist) corroborated this issue: "oXygen does correctly resolve the import if the main XQuery was loaded from the file system, but *not* if you opened it using WebDAV. The error message indicates that Oxygen is looking for the module on the file system."

Thus, my bug/feature request: Add the ability for oXygen's XQuery Validation to resolve a relative path to a module imported by an XQuery file stored in eXist-db. In other words, relative paths should be evaluated relative to the location of the original XQuery file.

Note: I'm using oXygen XML Editor v11.1 with eXist 1.4.x-stable. By "validate" I mean open an XQuery file and select Document > Validate > Validate Document. I've selected my eXist instance as my XQuery validator via Preferences > XQuery > XQuery Validate with. Otherwise, XQuery validation and function auto completion work perfectly, so I know the connection with eXist works.

Please let me know if I can provide any other information.

Thank you,
Joe

Re: XQuery Validation problem with imported modules

Posted: Wed Jan 06, 2010 9:30 pm
by joewiz
Wolfgang added in a followup e-mail:
Sorry, I was mistaken. The error message is coming from eXist.

If I remember well, oXygen just sends the entire query to eXist for
validation. However, eXist has no idea where the query source was
loaded from. I guess we need to find a way for oXygen to pass a module
load path which can be used by eXist to resolve the imports correctly.

Re: XQuery Validation problem with imported modules

Posted: Thu Jan 07, 2010 2:01 pm
by adrian
Hello,

I can confirm what Wolfgang has mentioned, oXygen sends the entire query to eXist for validation. As far as I know there is no way to specify a server URI for the XQuery through the API so that's why the relative location of the module cannot be determined for XQuery validation or execution.

We will investigate and if the API has or will have the possibility to specify the XQuery URI we will support it in a future version.

Regards,
Adrian

Re: XQuery Validation problem with imported modules

Posted: Sat Jan 09, 2010 4:34 am
by joewiz
Hi Adrian,

Thank you very much for your reply. I've passed your response on to the eXist developers. It would be great if the eXist & oXygen devs could find a way!

Joe

Re: XQuery Validation problem with imported modules

Posted: Fri Sep 20, 2013 4:13 pm
by Radu
Hi,

Just to update this thread, Oxygen 15.0 also sends to the server when validating a module the base URI of the module, thus allowing the server to properly resolve relative references.

Regards,
Radu

Re: XQuery Validation problem with imported modules

Posted: Tue Jul 21, 2020 1:37 am
by Darin
I am getting this same problem in oxygen 21.1 with a WebDAV datasource connection to eXist 5.1.1. I open an xquery from WebDAV and the relative path of the imported module cannot resolve. I open the same xquery using xmlrpc and it works fine.
Regression?

Re: XQuery Validation problem with imported modules

Posted: Tue Jul 21, 2020 8:16 am
by Radu
Hi Darin,

This is not a regression, in Oxygen 15 we fixed things to properly work with the xmlrpc API (API which is used to validate the XQuery), before it even when using the xmlrpc API you got a validation error when your XQuery imported a module.
When using Webdav, the XQuery validation is not done against the Exist server, it's done with the Saxon XSLT processor bundled with Oxygen which probably has a hard time finding the import if the reference is not relative to the current XQuery file.

Regards,
Radu