XQuery transformation

XQuery is designed to retrieve and interpret XML data from any source, whether it is a database or a document. Data is stored in relational databases but often it is required that data is extracted and transformed as XML when interfacing to other components and services Also, it is an XPath-based querying language supported by most NXD vendors.

To perform a query you will first need to configure a data source and a connection (details can be found in the Relational Database Support and Native XML Database Support sections).

Next, configure a transformation scenario and associate it with your XQuery document:

  1. Open the Configure Transformation Scenario dialog.

  2. Click the New button.

  3. In the Edit Scenario dialog insert the scenario's name. Then, from the list of available Transformers choose the database connection you need. Configure any other parameters if necessary.

  4. Click OK to finish editing the scenario.

For an XQuery transformation the output tab has an option called Sequence which allows you to execute an XQuery in lazy mode. The amount of data extract from the database is control from option Size limit on Sequence view. If you choose Perform FO Processing in the FO Processor tab, Sequence option is ignored.

Once the scenario is associated with the XQuery file, depending on the target database engine the query can include calls to specific XQuery functions implemented by that engine. For example for the eXist and Berkeley DB engine the content completion assistant lists the functions supported by that database engine. This is useful for inserting in the query only calls to the supported functions (standard XQuery functions or extension ones).

To query the database, apply the transformation scenario associated with your XQuery document. To view a more complex value returned by the query that cannot be displayed entirely in the XQuery query result table at the bottom of the Eclipse window, for example an XMLTYPE value or a CLOB value, you have to right click on that cell, select the action Copy cell from the popup menu for copying the value in the clipboard and paste the value where you need it, for example an opened XQuery editor panel of Eclipse .