|
|
|
|
|
|
| Author |
Message |
watch1 *nix forums beginner
Joined: 04 May 2006
Posts: 3
|
Posted: Thu May 04, 2006 4:37 am Post subject:
Query for document names in dbxml Shell
|
|
|
I am new to Berkeley dbxml and xml/xpath/xquery in general. I have
succeeded in storing a document in a container. Now I want to query for
the document name. Reading various references there seems to be more
than one way to do this. I cannot get any of them to work:
1. "collection("foo")//*/@dbxml:id"
2. 'collection("foo")//*//@dbxml:name'
3. for $a in collection("foo") return dbxml:metadata("name", $a)
I either get 0 results or a query error.
Has anyone made this work? |
|
| Back to top |
|
 |
Ron *nix forums Guru Wannabe
Joined: 01 Apr 2005
Posts: 157
|
|
| Back to top |
|
 |
watch1 *nix forums beginner
Joined: 04 May 2006
Posts: 3
|
Posted: Thu May 04, 2006 10:51 pm Post subject:
Re: Query for document names in dbxml Shell
|
|
|
OK, this time it worked as advertised. In hindsight it all makes sense
now.
++++++++++++++++++++++++++++++++++++++++++++++++++++++
1. This works:
dbxml> openContainer etc.dbxml
dbxml> info
Default container name: etc.dbxml
Type of default container: WholedocContainer
Index Nodes: off
Shell and XmlManager state:
Transactional, no active transaction
Verbose: on
Query context state: LiveValues,Eager
dbxml> query '
for $a in collection() return dbxml:metadata("dbxml:name", $a) '
1 objects returned for eager expression '
for $a in collection() return dbxml:metadata("dbxml:name", $a) '
dbxml> print
MyName
dbxml>
++++++++++++++++++++++++++++++++++++++++++++++++++++++
2. This does not work (no default container):
dbxml> preload etc.dbxml
dbxml> info
No default container
Shell and XmlManager state:
Transactional, no active transaction
Verbose: on
Query context state: LiveValues,Eager
dbxml> query '
for $a in collection() return dbxml:metadata("dbxml:name", $a) '
stdin:4: query failed, Error: The default collection has not been set
[err:FODC0
002]
dbxml>
++++++++++++++++++++++++++++++++++++++++++++++++++++++
3. This works (no default container):
dbxml> preload etc.dbxml
dbxml> info
No default container
Shell and XmlManager state:
Transactional, no active transaction
Verbose: on
Query context state: LiveValues,Eager
dbxml> query '
for $a in collection("etc.dbxml") return dbxml:metadata("dbxml:name", $
a) '
1 objects returned for eager expression '
for $a in collection("etc.dbxml") return dbxml:metadata("dbxml:name", $
a) '
dbxml> print
MyName
dbxml>
++++++++++++++++++++++++++++++++++++++++++++++++++++++
3. This does not work for painfully obvious reasons [in hindsight] (no
default container):
dbxml> preload etc.dbxml
dbxml> info
No default container
Shell and XmlManager state:
Transactional, no active transaction
Verbose: on
Query context state: LiveValues,Eager
dbxml> query '
for $a in collection('etc.dbxml') return dbxml:metadata("dbxml:name", $
a) '
stdin:11: query failed, Error: Error in XQuery expression:
Unrecognized character 'e' (0x70) [err:XPST0003], line 2,
column 24
dbxml>
++++++++++++++++++++++++++++++++++++++++++++++++++++++
In all cases openContainer or preload must be called on the container
before the query is attempted. If the container is in another folder
you can specify the -h command line parameter to set the default folder
for dbxml or you can append the folder before the container name in the
openContainer, preload and collection functions. If you are using
Windows, the backslashes "\" in the path must be replaced by forward
slashes "/".
Ron - Thanks for the encouragement to try again. |
|
| Back to top |
|
 |
watch1 *nix forums beginner
Joined: 04 May 2006
Posts: 3
|
Posted: Thu May 04, 2006 10:55 pm Post subject:
Re: Query for document names in dbxml Shell
|
|
|
Does anyone know when the expression:
collection("foo")//*//@dbxml:name
can be used to obtain a list of document names? |
|
| Back to top |
|
 |
Google
|
|
| Back to top |
|
 |
|
|
The time now is Sat Jan 10, 2009 3:05 am | All times are GMT
|
|
Car Loan | Meeting Rooms | PunBB forum hosting | Credit Cards | Free Ringtone
|
|
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
|
|