Using oXygen with eXist-db

(2Q19)


This article describes how to use eXist-db in combination with the oXygen XML Editor IDE.

Overview

oXygen XML Editor is a powerful IDE for working with XML in general but also with eXist-db. Its eXist-db specific capabilities include:

  • Browsing eXist-db database contents

  • Editing database contents (open, save, rename documents; create, rename collections)

  • Editing XQuery files and continuously validate them against eXist-db's XQuery engine

  • Executing queries and displaying results

This article describes how to configure oXygen to work with eXist-db. See also oXygen's eXist-db support article.

How to tell oXygen about your eXist-db installation

Please also check the oXygen documentation for your version of oXygen

To tap into eXist-db via oXygen, you must tell oXygen a bit about your eXist-db installation. First, we need to create an entry for eXist-db in oXygen's list of Data Sources. Then we need to create an entry in its list of Data Connections; this involves providing oXygen with a URL and account information for your eXist-db instance.

  1. In oXygen, go to Preferences > Data Sources, and you will see a window with two areas: Data Sources (at the top) and Connections (at the bottom).

  2. Click the Create eXist-db XML connection link at the top.

  3. Fill in the dialog (for a default installation. You'll only need to change the user to admin and fill in its password)

  4. Click ok on all subsequent dialogs (if any). This will create both a Data Source and Connection for you.

How to browse your database contents

Now that you have created an oXygen Data Source and Connection for eXist-db, you can browse your database contents from within oXygen in two ways:

  • Use the Data Source Explorer, an oXygen pane that lists your Connections including the one you created above. To open the Data Source Explorer, select Window, Show view, Data Source Explorer. You can now browse collections and their contents. Right click on these items display contextual menus.

  • Use the File, Open URL to browse and pick documents from the eXist-db database. The first time you connect you need to fill in several fields, among which your eXist-db account credentials and server URL (e.g., http://localhost:8080/exist/webdav/db/)

How to validate XQuery files against eXist-db's XQuery engine

By default oXygen uses Saxon to validate XQuery files. Saxon is a fine tool for validating XQuery (among its many capabilities), but it lacks knowledge of eXist-db built-in functions and other settings. Therefore if you are creating XQuery to use in eXist-db, you will find numerous advantages in configuring oXygen to use eXist-db for validation. The steps to complete this configuration are very easy:

  1. In oXygen, go to Preferences and in the window that appears select XML > XSLT-XQuery > XQuery. On the dropdown menu on the right labeled, Validation engine:, select the name of the Data Connection that you created above.

Now when you are editing an XQuery file in oXygen, the validation information you receive (for instance when you click on the Validate toolbar button) is supplied from eXist-db.

How to execute queries and display results

You can also execute queries against eXist-db from within oXygen:

  1. Open the XQuery file that you would like to execute.

  2. Select the Configure Transformation Scenario toolbar button, select the New button, and select XQuery Transformation in the dropdown menu.

  3. A new dialog will appear with fields to configure your XQuery transformation settings. Enter a Name for the transformation (e.g., "Transform with eXist-db"). In the Transformer dropdown menu select the Data Connection you created above.

  4. From now on you can execute any query using this transformation scenario by simply selecting the Apply Transformation Scenario toolbar button