Related Efforts
  XQuery Style

Quick Start

  xqDoc Comments
  xqDoc Schema
  xqDoc Conversion
  xqDoc Display
  xqDoc Drivers


Sample Output
  xqDoc Basic
  xqDoc Standard
  xqDoc Enhanced

  Who We Are


The eXist quick start guide is courtesy of Wolfgang Meier

This quick start guide provides instructions for using xqDoc with the eXist Open Source XML database Future versions of eXist will use xqDoc to document eXist's own library modules, so xqDoc will probably be included in the main distribution of eXist. In the meantime, the following describes how to set up eXist for xqDoc.

You should download the most recent stable build of eXist from SourceForge.

Setting up the classpath

To run the xqDoc drivers, you need the following jar files in your CLASSPATH.

From eXist:

  • exist.jar
  • lib/core/xmldb.jar
  • lib/core/xmlrpc-1.2-patched.jar
  • lib/core/antlr.jar

From xqDoc:

  • xqdoc_conv.jar available here

Plus the eXist driver jar for xqDoc:

  • xqdoc_eXist.jar available here


This driver parses a set of XQuery files from the file system and stores the generated xqDoc XML into the database collection /db/xqdoc on an eXist server. The invocation should look as follows:

java org.xqdoc.drivers.exist.EXistFileDriver dirOrFile [serverURI] [user] [password]

  • dirOrFile: is either a directory or a single XQuery file.
  • serverURI: (optional) the XML:DB URI of the root database collection. By default this is xmldb:exist://localhost:8080/exist/xmlrpc/db, which corresponds to a default eXist setup.
  • user: (optional) the user name to use for the connection.
  • password: (optional) the password.

So, assuming that ...

  • your XQuery files are in /home/test/xquery
  • your eXist server is running on host

the correct command line would be ...

java org.xqdoc.drivers.exist.EXistFileDriver


Use this version of the driver if your XQuery sources are stored in a database collection, not in the file system. The first parameter is the collection to scan for XQuery modules. All other parameters are like above.

So assuming that you want to parse the XQuery modules stored in the database collection /db/modules, you would use ...

java org.xqdoc.drivers.exist.EXistStoredModuleDriver


This driver, similar to the MarkLogicZipDriver, will create an off-line viewing mode for the xqDoc XML. This driver is currently under development and will be available soon.


We will run the xqDoc scripts through the XQueryServlet. It is also possible to install them as stored XQuery modules directly on the database server. Once you have installed eXist, start the server as described in the documentation.

Create a new directory "xqdoc" below the webapp directory in the eXist installation directory. Copy the XQuery file

  • xqdoc-display.xqy

from the package into the xqdoc directory.

Next, copy

  • default.xqy
  • get-code.xqy
  • get-module.xqy

shipped with the eXist driver to the same location. Those files contain some vendor-specific function calls that have to be adopted for eXist.

With the xqDoc XML stored in the database, it can now be viewed with the xqDoc presentation scripts. If the xqDoc scripts were installed as described above, you can view the xqDoc module home page at:


Installation Verification

If user-defined XQuery library and main modules are not readily available, the xqDoc display scripts can be used to verify the proper configuration of the eXist environment and usage of the eXist provided drivers. To use these scripts, reference the eXist webapps/xqdoc directory (as the directory for the .xqy files to process) when executing the EXistFileDriver. When the xqDoc presentation output is viewed ...


it should look very similar to the enhanced output. The main difference will be the W3C XPath Functions and Operators will not be hypertext linked.