Database Reference
In-Depth Information
Not all of the available Java modules are enabled by default. Even worse, some of
them are not even built in (compiled and linked) to the default eXist configuration!
How to find out which are built in and/or enabled, and what to do about it is covered
in “Enabling Java Extension Modules” on page 129 . Writing your own extension mod‐
ules in Java is covered in “Internal XQuery Library Modules” on page 467 .
If you use eXide, oXygen, or another eXist-aware IDE, there is a
very easy way to find out whether a Java-based extension module is
enabled. While editing an XQuery script, type the prefix of the
module and press the shortcut keys that pop up autocompletion
suggestions (usually Ctrl-space bar). If a list of functions appears,
the module is enabled.
Extension Modules Written in XQuery
Some extension modules are written in XQuery. To use them, you need to explicitly
import the module by placing an import module statement in your XQuery code.
You need not specify the at clause because eXist already knows where to find them.
For instance, to use the KWIC (see “Using Keywords in Context” on page 297 ) exten‐
sion module, you would add the following to your XQuery prolog:
import module namespace kwic="http://exist-db.org/xquery/kwic";
XQuery-based modules can be disabled too. However, in contrast to Java-based mod‐
ules, this only means eXist doesn't know their location and you have to add an at
clause to your import module statement if you still want to use them. Read more
about this in “Enabling XQuery Extension Modules” on page 130 .
Enabling Extension Modules
This section will tell you how to enable an extension module. There are two files/
locations that are important here:
$EXIST_HOME/conf.xml
Search this file for the builtin-modules element. Within you'll find module ele‐
ments, some of which are commented out. As you might have guessed, enabling
a module here means removing the comment from the appropriate module ele‐
ment (and restarting eXist).
The module elements also show you the type of the module (Java or XQuery).
Java modules have a class attribute. For instance:
<module uri= "http://exist-db.org/xquery/xmldb"
class= "org.exist.xquery.functions.xmldb.XMLDBModule" />
But XQuery modules have a src attribute:
Search WWH ::




Custom Search