Re: Query for document names in dbxml Shell -
05-04-2006
, 05:51 PM
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. |