|
|
|
|
|
|
| Author |
Message |
Grimbal *nix forums beginner
Joined: 24 Feb 2005
Posts: 9
|
Posted: Tue Mar 01, 2005 4:44 pm Post subject:
Re: How to use @dbxml:name in an XQuery in DBXML?
|
|
|
Ah... That explains it. I saw plenty of examples with @dbxml:name,
but none worked.
But both your examples work fine. Thanks a lot.
Florian |
|
| Back to top |
|
 |
George *nix forums Guru Wannabe
Joined: 26 Feb 2005
Posts: 198
|
Posted: Mon Feb 28, 2005 5:57 pm Post subject:
Re: How to use @dbxml:name in an XQuery in DBXML?
|
|
|
Grimbal wrote:
| Quote: | Hello,
I am desperately trying to select a record by name in an XML
container.
I want to select a record using something like:
collection("current.dbxml")/*[@dbxml:name="pump_def"]
It doesn't find the record.
If I do
collection("current.dbxml")/*
I can see it. And if I use
lookupIndex(qc, uri, name, strategy)
with
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.
|
There are several ways to do what you want.
If you just want the named document itself,
you can use a query like:
doc('current.dbxml/pump_def')
Note the use of doc() vs collection()
The way to name a document using the dbxml:name metdata
item is this:
collection('current.dbxml')/*[dbxml:metadata('dbxml:name')='pump_def']
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
metadata.
Regards,
George |
|
| Back to top |
|
 |
Grimbal *nix forums beginner
Joined: 24 Feb 2005
Posts: 9
|
Posted: Thu Feb 24, 2005 8:02 am Post subject:
How to use @dbxml:name in an XQuery in DBXML?
|
|
|
Hello,
I am desperately trying to select a record by name in an XML container.
I want to select a record using something like:
collection("current.dbxml")/*[@dbxml:name="pump_def"]
It doesn't find the record.
If I do
collection("current.dbxml")/*
I can see it. And if I use
lookupIndex(qc, uri, name, strategy)
with
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.
Any ideas?
I am using DBXML 2.0.7, in C++ (gcc), on Solaris.
Thanks in advance.
Florian Fischer |
|
| Back to top |
|
 |
Google
|
|
| Back to top |
|
 |
|
|
The time now is Thu Jan 08, 2009 4:29 am | All times are GMT
|
|
Problem Mortgage | Bankruptcy | Online Degree Schools | Advance Auto Parts | Credit Card Consolidation
|
|
Copyright © 2004-2005 DeniX Solutions SRL
|
|
|
|
Other DeniX Solutions sites:
Unix/Linux blog |
electronics forum |
medicine forum |
science forum |
|
|
Privacy Policy
|
Powered by phpBB © 2001, 2005 phpBB Group
|
|