How to address a document inside a basex database?
Sunday, 28 March 2010 · 2 messages
SS
Sandra Maria Silcot28 Mar 2010 00:02 #
Hi all,
I have a large database of about a dozen separate xml files. When I use the GUI interface, I can see them all in the graphical display, and as I pass the cursor over elements, it displays
doc("om.xml")/...
But when I try that in a query (the database is open), I'm told:
FODC0002 File or directory C:/servers/basex/om.xml not found
The basex installation is at C:/servers/basex and the currently opened database ("fasdb"), which was loaded from file 'om.xml' and others on a different machine, and downloaded, lives here:
C:/servers/basex/BaseXData/fasdb
How can I refer just to one document from that db in a query e.g.
let $persons := doc("om.xml")//personForgive me if this is a basic error on my part, I am still learning. I have tried variations on the basex:db construct, but all give a file not found error. If I move the document to where it is looking, basex builds a new db, not what I want at all!
I'm sure there is a simple solution but I cannot see it. Any clues much appreciated.
Cheers all,
Sandra
CG
Christian Grün28 Mar 2010 04:38 #
..this is an easy one (yet, no reason to be sorry…): you can use the collection() and basex-uri() functions to find a file within a collection. The following example might give you some hints:
http://basex.org/code/CollectionQueryExample
Hope this helps,
Christian
Quoted text · Sandra Maria Silcot · 44 lines
On Sun, Mar 28, 2010 at 12:02 AM, Sandra Maria Silcot <ssilcot at unimelb.edu.au> wrote: > Hi all, > > I have a large database of about a dozen separate xml files. When I use > the GUI interface, I can see them all in the graphical display, and as I > pass the cursor over elements, it displays > > doc("om.xml")/... > > But when I try that in a query (the database is open), I'm told: > > FODC0002 File or directory C:/servers/basex/om.xml not found > > The basex installation is at C:/servers/basex and the currently opened > database ("fasdb"), which was loaded from file 'om.xml' and others on a > different machine, and downloaded, lives here: > > C:/servers/basex/BaseXData/fasdb > > How can I refer just to one document from that db in a query e.g. > > let $persons := doc("om.xml")//person > > Forgive me if this is a basic error on my part, I am still learning. I > have tried variations on the basex:db construct, but all give a file not > found error. If I move the document to where it is looking, basex builds a > new db, not what I want at all! > > I'm sure there is a simple solution but I cannot see it. Any clues much > appreciated. > > Cheers all, > > Sandra > > > > > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk >
Written for BaseX 6. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery