Right now, I'm aware of two ways to set the context item via the native protocol:
Here are some other alternatives (...not sure what you mean with the "native protocol"?): -- If you are using the command-line, you can also use the "-i" flag to bind documents or databases to the context. -- If you are working more low level, you can directly bind items to the QueryProcessor [1] -- If you are using REST, you can use the Context parameter (e.g., the rest:context element) to bind items to the context [2]
(2) Use the "CS" ["Context Set"] command
- Disadvantage: Requires a database to be open (why?)
This command works similar to other database commands, which refer to the currently opened database instance.
What's the way you would prefer? Christian
[1] https://github.com/BaseXdb/basex-examples/blob/master/src/main/java/org/base... [2] http://docs.basex.org/wiki/REST