Page 1 of 1

XQuery collection() function on Web Dav server

Posted: Wed Dec 16, 2015 4:20 pm
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?

Re: XQuery collection() function on Web Dav server

Posted: Thu Dec 17, 2015 3:11 pm
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

Re: XQuery collection() function on Web Dav server

Posted: Sat Feb 06, 2016 6:28 am
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

Re: XQuery collection() function on Web Dav server

Posted: Mon Feb 08, 2016 7:06 pm
by adrian
Hi,

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

Regards,
Adrian

Re: XQuery collection() function on Web Dav server

Posted: Tue Feb 09, 2016 1:36 pm
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

Re: XQuery collection() function on Web Dav server

Posted: Wed Feb 10, 2016 12:45 am
by luxlunae
Thanks! I will try that. I've been very frustrated trying to get collections to work in oxygen.