Yep, the latest commit fixes the issue.
Regarding our Wiki.. Feel free to get an account ;)
Hehe :D, let's just say I'm in *your* shoes (missing a bit of a documentation *here and there* :) so if I write anything that looks like documentation that'll be about my daily job - although (right now) I don't play on writing anything. Sorry about this also! :)
Anyway, thanks for the help! I'll try to comprehend the code and next time (if have any problem) I'll post a pull request or a ticket on GitHub.
Regards, Kohányi Róbert
On Mon, Apr 9, 2012 at 5:44 PM, Christian Grün christian.gruen@gmail.comwrote:
Right now calling:
collection("d:/Work/purchaseOrder/xml")
results in:
[FODC0002] Resource "D:/Apps/BaseX/Work/purchaseOrder/xml" not found.
Thanks for looking into the code and thinking about proposing your own fix. Truely, quite a lot is going in here, exactly because collection() and doc() are heavily overloaded with functionality (the argument may point to a database or parts of it, a single file, directory, remote URL, represent an XML string, etc..).
I hope that my most recent commit solves the issue.
using "d:/Work/purchaseOrder/xml" works as expected (however in the documentation of the function it could be noted, that it only accepts
path
strings; file URLs like "file:///c:/..." doesn't work).
True; the file module could be extended to also acccept URLs. Regarding our Wiki.. Feel free to get an account ;)
Christian _______________________________
"D:/Apps/BaseX" is the directory of my BaseX installation.
The code "IO io= IO.get(input);" at QueryResources#data(...)[1] seems to
be
doing the strange concatenation. The method "IO#get(...)" calls IOFile#IOFile(...)[2] and in this constructor the
"File#getAbsolutePath()"
method call evaluates to the BaseX installation directory (installation
==
I've only a copied, zipped version of BaseX, I didn't install anything). After this checking the path "D:/Apps/BaseX/Work/purchaseOrder/xml"
fails.
I couldn't fix the issue myself as I don't the implications of changing anything in the code (moreover changing something like IOFile), so I've replied to your email instead of creating a pull request on GitHub
(although
I could have created a ticket, but I'm too lazy for that after writing
this
email - sorry about that :).
Oh yeah, the other thing:
for $file in file:list('/path/to/directory', true(), '*.xml') let $content := file:read-text($file) return parse-xml($content)
using "d:/Work/purchaseOrder/xml" works as expected (however in the documentation of the function it could be noted, that it only accepts
path
strings; file URLs like "file:///c:/..." doesn't work).
Regards, Kohányi Róbert
[1]:
https://github.com/BaseXdb/basex/blob/master/src/main/java/org/basex/query/Q...
[2]:
https://github.com/BaseXdb/basex/blob/master/src/main/java/org/basex/io/IOFi...
On Mon, Apr 9, 2012 at 4:07 PM, Christian Grün <
christian.gruen@gmail.com>
wrote:
The bug has been fixed (along with the issue you mentioned on StackOverflow); please check out one of our latest stable snapshot [1].
Christian
[1] http://files.basex.org/releases/latest/ ___________________________
On Mon, Apr 9, 2012 at 2:39 PM, Christian Grün christian.gruen@gmail.com wrote:
Hi Róbert,
If yes, is that means that using BaseX one can only query multiple
XML
files after creating a database for them? If not, ... is this a bug? (I highly doubt.)
you may be surprised to hear (..at least I was..) that this *is* a bug. We're currently fixing this; please expect an update soon.
(On a side note: something like DataDirect - supposedly - can do[2] would be awesome in BaseX. Was this ever considered to include in BaseX?)
There are various ways to do this in BaseX. One of them is to use file:list() [1] and the fn:parse-xml() function of XQuery 3.0:
for $file in file:list('/path/to/directory', true(), '*.xml') let $content := file:read-text($file) return parse-xml($content)
We also thought about overloading the collection() function with additional features, but we eventually decided against this approach, as it's already does too much anyway (or does too less, as you just noticed).
Keeping you updated, Christian
[1] http://docs.basex.org/wiki/File#file:list
On Mon, Apr 9, 2012 at 8:52 AM, Róbert Kohányi kohanyi.robert@gmail.com wrote:
BaseX's documentation and the following (an excerpt from an email on the mailing list[1]) says this on the fn:collection function:
fn:collection() either returns documents of a database or of the specified location
From this it seems that it can return the documents of a specified location (without ever creating a database), however the following query:
collection("<xml-dir>")
reports the following error (using both the GUI and the
command-line):
[FODC0004] File or directory "File or directory "<basex>" not found." not found.
(Using Windows 7) I passed several kind of path to the collection function ("c:/xml-dir", "file:///c:/xml-dir", ...), but none of them works. Also, the actual path of "<basex>" in the error depends on whether I start the GUI (<basex>/BaseX.jar) or the command-line (<basex>/bin/basex.bat); the respective paths in these two cases are "<basex>" and "<basex>/bin".
(Issuing something like doc("<xml-dir>/<xml-file>") works.)
Is this the expected behavior?
If yes, is that means that using BaseX one can only query multiple
XML
files after creating a database for them? If not, ... is this a bug? (I highly doubt.)
(On a side note: something like DataDirect - supposedly - can do[2] would be awesome in BaseX. Was this ever considered to include in BaseX?)
My reason for doing a query like this is: I've just tried to ran it
and
it didn't work, so I'm here.
Thanks!
Regards, Kohányi Róbert
[1]:
https://mailman.uni-konstanz.de/pipermail/basex-talk/2011-November/002213.ht...
[2]:
http://www.xquery.com/tips_and_tricks/querying_multiple_documents.html
BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk