Error importing function modules with eXist

Having trouble installing <oXygen/>? Got a bug to report? Post it all here.
duck1123
Posts: 3
Joined: Wed Jul 20, 2005 8:01 pm
Location: Westland, MI
Contact:

Error importing function modules with eXist

Post by duck1123 » Sat Mar 04, 2006 7:27 pm

Hello,
I have been testing out the new integration with an eXist db. I have done everything I'm supposed to, including compiling the latest version from CVS, and copying all of the relevant jars, and I am able to send XQuries to eXist and get the propper results back. (a little slowly maybe, but that just may be my computer.)

I am opening a XQuery from /db/kronk/mycyclopedia/ by using the Webdav interface. Everything works fine, until I try to open a query that references a *.xqm (XQuery Module) located in the same collection/folder.

My XQuery looks like this:
(: snip :)
import module namespace mycf="http://www.mycyclopedia.net/functions" at "functions.xqm";
(: snip :)

when I try to run or validate this query, I get the error:
SystemID: http://kronk@68.40.179.36:8080/exist/we ... irthday.xq
Description: error found while loading module mycf: source for module http://www.mycyclopedia.net/functions not found: cannot read module source from file at C:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\exist\functions.xqm

shouldn't Oxygen try to load that file from: http://kronk@68.40.179.36:8080/exist/we ... ctions.xqm and not from the exist webapp directory in Tomcat? Is this a bug, or am I just doing something wrong. (The query works from within eXist)

Daniel E. Renfer (http://kronkltd.net/)
----------------------------------------------
Lord Anas M. Nebuchadnezzar XXXVII
Freelance Individual
http://www.kronkltd.net/

stefan
Posts: 45
Joined: Wed Jan 08, 2003 9:43 am
Contact:

Post by stefan » Mon Mar 06, 2006 3:40 pm

The eXist server loads modules relative to its own context and we cannot change that from oXygen (that connects to the server remotely - through XML-RPC). You will get the same result running eXist Client Shell and using the Remote type to connect.

It is a good practice to not use relative paths for imported modules but use instead the following:

- if the module is in your database : xmldb:exist:///db/path/module.xq
- if the module is in your file system : file:///C:/path/module.xq
- if the module is available through http : http://server/path/module.xq.

In your case, the import will look like that:

import module namespace mycf="http://www.mycyclopedia.net/functions" at "xmldb:exist:///db/kronk/mycyclopedia/functions.xqm";

Post Reply