XQuery collection() function on Web Dav server

Issues related to W3C XQuery.
proxx
Posts: 6
Joined: Wed Dec 16, 2015 3:49 pm

XQuery collection() function on Web Dav server

Post by proxx »

I am using Oxygen XML Editor 17.0 (Saxon XQuery 9.6.0.5). Recently I have created a very basic XQuery code to perform some statistic measurements over the XML files on Web Dav server. Let's say I just want to count the number of .xml files in one directory. I added the XQuery file to the location where .xml files are. Here is the code:

Code: Select all

xquery version "3.0" encoding "utf-8";
let $docs := collection('./?select=*.xml')
return count($docs)
I receive an error message: "FODC0004: Collection catalog should not use a namespace"

The code works fine when run locally. I am also able to search over one particular file (on server) using absolute path, but I want to have a universal code.

I am guessing it is connected with some restrictions on Web Dav server, but I am a newbie in this area. Could you please advice?
Radu
Posts: 9049
Joined: Fri Jul 09, 2004 5:18 pm

Re: XQuery collection() function on Web Dav server

Post by Radu »

Hi,

Basically as Michael Kay explained you:

http://stackoverflow.com/questions/3431 ... dav-server

the Saxon processor can only use the collection function to iterate a folder's contents when running the query over a local set of resources.

In the Oxygen Preferences->XML / XSLT-FO-XQuery / XSLT / Saxon / Saxon-HE/PE/EE / Advanced you can set a custom collection URI resolver Java implementation.
Another possible workaround would be instead of using a plain WebDav server to install the Exist XML Database. Exist allows you to run xqueries on the server side.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
luxlunae
Posts: 26
Joined: Wed Jun 17, 2015 10:01 pm

Re: XQuery collection() function on Web Dav server

Post by luxlunae »

What would such a declaration look like for a collection of files in the following folder? I'm getting the same error but the documentation doesn't really give any examples for those preferences.

This is the line of code throwing the error:

let $names := collection('file:///D:/BlueMountainTEI/periodicals/bmtnaau/issues/1908/03_01/bmtnaau_1908-03_01.tei.xml')//tei:relatedItem[@type='constituent']//tei:persName


Thanks
adrian
Posts: 2855
Joined: Tue May 17, 2005 4:01 pm

Re: XQuery collection() function on Web Dav server

Post by adrian »

Hi,

Any reason why you're using collection and not doc() in this particular case?

Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
adrian
Posts: 2855
Joined: Tue May 17, 2005 4:01 pm

Re: XQuery collection() function on Web Dav server

Post by adrian »

Well, to answer your question, if you want a collection with all the .xml files from a local folder you can use:

Code: Select all

collection('file:///D:/BlueMountainTEI/periodicals/bmtnaau/issues/1908/03_01/?select=*.xml;recurse=yes')
Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
luxlunae
Posts: 26
Joined: Wed Jun 17, 2015 10:01 pm

Re: XQuery collection() function on Web Dav server

Post by luxlunae »

Thanks! I will try that. I've been very frustrated trying to get collections to work in oxygen.
Post Reply