niXforums Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   PreferencesPreferences   Log in to check your private messagesLog in to check your private messages   Log inLog in 
·  nixdoc.net ·  man pages ·  Linux HOWTOs ·  FreeBSD Tips ·  Forums
navigation Forum index » Databases » Berkeley DB
How to use @dbxml:name in an XQuery in DBXML?
Post new topic   Reply to topic Page 1 of 1 [3 Posts] View previous topic :: View next topic
Author Message
Grimbal
*nix forums beginner


Joined: 24 Feb 2005
Posts: 9

PostPosted: Tue Mar 01, 2005 4:44 pm    Post subject: Re: How to use @dbxml:name in an XQuery in DBXML? Reply with quote

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

PostPosted: Mon Feb 28, 2005 5:57 pm    Post subject: Re: How to use @dbxml:name in an XQuery in DBXML? Reply with quote

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

PostPosted: Thu Feb 24, 2005 8:02 am    Post subject: How to use @dbxml:name in an XQuery in DBXML? Reply with 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.

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
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 1 [3 Posts] View previous topic :: View next topic
The time now is Thu Jan 08, 2009 4:29 am | All times are GMT
navigation Forum index » Databases » Berkeley DB
Jump to:  

Similar Topics
Topic Author Forum Replies Last Post
No new posts problem updatenodes in dbxml mahdieh Berkeley DB 0 Thu Jul 20, 2006 5:15 pm
No new posts JVM Crash with DBXML dgalewsky@gmail.com Berkeley DB 0 Wed Jul 19, 2006 10:35 pm
No new posts [Announce]DataDirect XQuery Webinar Tomorrow (Thursday Ju... datadirectxquery@gmail.co IBM DB2 0 Wed Jul 19, 2006 3:45 pm
No new posts xml xquery and php manish PHP 0 Mon Jul 17, 2006 6:00 am
No new posts Berkeley DBXML vs eXist - tuning Berkeley? tfga Berkeley DB 1 Sat Jul 15, 2006 1:02 am

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
[ Time: 0.1484s ][ Queries: 20 (0.0695s) ][ GZIP on - Debug on ]