Hi there,
the most convenient way to identify documents inside collections might be restricting the the query to a single document or a group of documents via matching the document-uri()
for $doc in basex:db('yourdb') where matches(document-uri($doc),'test.xml') return $doc
Please note that the document-uri() function only evaluates document-nodes, to test against inner nodes you should use base-uri($node) instead of document-uri():
for $node in basex:db('yourdb')//child where matches(base-uri($node),'test.xml') return $node
As there is no standardized way of handling collections of XML documents we are still looking forward to feedback regarding this issue.
Hope this helps, feel free to ask more otherwise.
Kind regards Michael
Am 29.07.2010 um 16:29 schrieb cosmotron+basex@gmail.com:
If I add two documents to a BaseX DB, let's say normal.xml and normal2.xml, is there a way to refer to each one individually?
I know about the doc() function, but it looks at the filesystem for their location, rather than in the database itself.
For instance, if I query with this: doc("normal.xml")/name , then I will get an error about normal.xml not being found.
I also tried: basex:db("my-db-name")/doc("normal.xml")/name and received the same error.
Thanks for any help!
BaseX-Talk mailing list BaseX-Talk@mailman.uni-konstanz.de https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk