XQuery Transformation

XQuery is designed to retrieve and interpret XML data from any source, whether it is a database or document. Data is stored in relational databases but it is often required that the data be 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 need an XQuery transformation scenario.
  1. Configure a data source for the database.
    The data source can be relational or XML native.
  2. Configure an XQuery transformation scenario.
    1. Click the Configure Transformation Scenario toolbar button or go to menu Document > Transformation > Configure Transformation Scenario.

      The Configure Transformation Scenario dialog box is opened.

    2. Click the New button in the dialog box.

      The dialog box for editing an XQuery scenario is opened.

      Figure: Edit Scenario Dialog Box

    3. Insert the scenario name in the dialog box for editing the scenario.
    4. Choose the database connection in the Transformer drop-down list.
    5. Configure any other parameters as needed.
      For an XQuery transformation, the output tab has an option called Sequence that allows you to run an XQuery in lazy mode. The amount of data extracted from the database is controlled from the option Size limit on Sequence view. If you choose Perform FO Processing in the FO Processor tab, the Sequence option is ignored.
    6. Click the OK button to finish editing the scenario.
    Once the scenario is associated with the XQuery file, the query can include calls to specific XQuery functions that are implemented by that engine. The available functions depend on the target database engine selected in the scenario. For example, for eXist and Berkeley DB XML, the Content Completion Assistant lists the functions supported by that database engine. This is useful for only inserting calls to the supported functions (standard XQuery functions or extension ones) into the query .
    Note: An XQuery transformation is executed against a Berkeley DB XML server as a transaction using the query transaction support of the server.
  3. Run the scenario.

    To view a more complex value returned by the query that cannot be entirely displayed in the XQuery query result table at the bottom of the Oxygen XML Developer window (for example, an XMLTYPE or CLOB value), do the following:

    • Right-click that table cell.
    • Select the Copy cell action from the contextual menu to copy the value into the clipboard.
    • Paste the value wherever you need it (for example, in an opened XQuery editor panel of Oxygen XML Developer).
Parent topic: XQuery and Databases Previous topic: Build Queries with Drag and Drop from the Data Source Explorer View Next topic: XQuery Database Debugging