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).
The file:// scheme is now also supported in the file functions. Morevoer, the paths returned by file:list() will be relative to its root, as printed in the documentation.
Best, Christian _____________________________
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