How to use @dbxml:name in an XQuery in DBXML? - 02-24-2005 , 03:02 AM
I am desperately trying to select a record by name in an XML container.
I want to select a record using something like:
It doesn't find the record.
If I do
I can see it. And if I use
lookupIndex(qc, uri, name, strategy)
uri = http://www.sleepycat.com/2002/dbxml
name = name
strategy = "unique-node-metadata-equality-string
I can see the record I am looking for, with the name 'pump_def'.
I tried to add the dbxml namespace to qc, it doesn't help.
It works if I add the dbxml:name and dbxml namespace in the XML
document that I store, but then, it selects the records based on that
attribute, and not on the name I gave when I put() the record.
I am using DBXML 2.0.7, in C++ (gcc), on Solaris.
Thanks in advance.
Re: How to use @dbxml:name in an XQuery in DBXML? - 02-28-2005 , 12:57 PM
If you just want the named document itself,
you can use a query like:
Note the use of doc() vs collection()
The way to name a document using the dbxml:name metdata
item is this:
In release 2.0, BDB XML metadata is no longer treated as an attribute
of the root element. It is separate from the actual XML, and can
be addressed using the dbxml:metdata() function built into the XQuery
mechanism. If you define your own metadata, remember to bind
your namespace prefix during your queries if you use one for the
Re: How to use @dbxml:name in an XQuery in DBXML? - 03-01-2005 , 11:44 AM
Ah... That explains it. I saw plenty of examples with @dbxml:name,
but none worked.
But both your examples work fine. Thanks a lot.