Everyone,
Here's my situation:
I'm using XQJ. I have an xml document stored as a java string, and I want to store this into an xquery collection. I see no way to do this without using the BaseX-specific libraries. I've looked everywhere, and the only thing I've found that's close is MonetDB's add-doc() function, but that takes a url as an argument, not a string. I want to do something like: insert node $document into collection("test"). Obviously this doesn't work because collections are sequences.
Any info is appreciated.
-tjw
Dear Travis,
it's true, unfortunately XQuery Update does not allow to add document nodes to collections/databases. One of the reasons is that the document node gets lost by the update, i.e. if your document looks as follows..
test.xml: <xml/>
..the following two expressions will do the same:
– insert node doc('test.xml') into … – insert node <xml/> into …
If you want to stick with XQJ and XQuery (Update), the easiest approach is to define one document root and add all new documents as children:
– insert node <xml>new document</xml> into /root
As other users had similar requests to yours, we are interested in your own suggestions how you would like to see this issue fixed (e.g., by adding some XQuery functions like basex:add("...") and basex:delete("...")).
Hope this helps, Christian
On Mon, Mar 1, 2010 at 6:35 AM, Travis Webb tjwebb@vt.edu wrote:
Everyone, Here's my situation: I'm using XQJ. I have an xml document stored as a java string, and I want to store this into an xquery collection. I see no way to do this without using the BaseX-specific libraries. I've looked everywhere, and the only thing I've found that's close is MonetDB's add-doc() function, but that takes a url as an argument, not a string. I want to do something like: insert node $document into collection("test"). Obviously this doesn't work because collections are sequences. Any info is appreciated. -tjw
___________________________
Christian Gruen Universitaet Konstanz Department of Computer & Information Science D-78457 Konstanz, Germany Tel: +49 (0)7531/88-4449, Fax: +49 (0)7531/88-3577 http://www.inf.uni-konstanz.de/~gruen
Christian,
Thank you for your response. I am using a collection, and do not want to use a single document. Is there any way I can add documents to it? I'm looking through the basex docs and see the "Add" class, but I don't see how I can do this on a server? It looks like Add can only operate on a local database. I'm looking for any solution. Thanks.
-tjw
On Mon, Mar 1, 2010 at 12:04 PM, Christian Grün christian.gruen@gmail.comwrote:
Dear Travis,
it's true, unfortunately XQuery Update does not allow to add document nodes to collections/databases. One of the reasons is that the document node gets lost by the update, i.e. if your document looks as follows..
test.xml: <xml/>
..the following two expressions will do the same:
– insert node doc('test.xml') into … – insert node <xml/> into …
If you want to stick with XQJ and XQuery (Update), the easiest approach is to define one document root and add all new documents as children:
– insert node <xml>new document</xml> into /root
As other users had similar requests to yours, we are interested in your own suggestions how you would like to see this issue fixed (e.g., by adding some XQuery functions like basex:add("...") and basex:delete("...")).
Hope this helps, Christian
On Mon, Mar 1, 2010 at 6:35 AM, Travis Webb tjwebb@vt.edu wrote:
Everyone, Here's my situation: I'm using XQJ. I have an xml document stored as a java string, and I want
to
store this into an xquery collection. I see no way to do this without
using
the BaseX-specific libraries. I've looked everywhere, and the only thing I've found that's close is MonetDB's add-doc() function, but that takes a url as an argument, not a string. I want to do something like: insert node $document into collection("test"). Obviously this doesn't
work
because collections are sequences. Any info is appreciated. -tjw
Christian Gruen Universitaet Konstanz Department of Computer & Information Science D-78457 Konstanz, Germany Tel: +49 (0)7531/88-4449, Fax: +49 (0)7531/88-3577 http://www.inf.uni-konstanz.de/~gruen
Dear Travis,
if you want to use the ADD command with the c/s architecture, you could specify the XML string as argument, or specify a URL to your document.
Best, Christian
On Mon, Mar 1, 2010 at 9:58 PM, Travis Webb tjwebb@vt.edu wrote:
Christian, Thank you for your response. I am using a collection, and do not want to use a single document. Is there any way I can add documents to it? I'm looking through the basex docs and see the "Add" class, but I don't see how I can do this on a server? It looks like Add can only operate on a local database. I'm looking for any solution. Thanks. -tjw
___________________________
Christian Gruen Universitaet Konstanz Department of Computer & Information Science D-78457 Konstanz, Germany Tel: +49 (0)7531/88-4449, Fax: +49 (0)7531/88-3577 http://www.inf.uni-konstanz.de/~gruen
basex-talk@mailman.uni-konstanz.de