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 need an XQuery transformation scenario.
-
Configure a data source for the database.
The data source can be relational or XML native.
-
Configure an XQuery transformation scenario.
-
Click the
Configure
Transformation Scenario toolbar button or go to menu .
The dialog for configuring a scenario will be opened.
-
Click the New button of the dialog.
The dialog for editing an XQuery scenario will be opened.
-
Insert the scenario name in the dialog for editing the scenario.
-
Choose the database connection in the Transformer combo
box.
-
Configure any other parameters if necessary.
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 extracted from the database is controlled from option Size limit on Sequence view. If you
choose Perform FO Processing in the FO
Processor tab, the Sequence option is
ignored.
-
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 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 inserting in the query only calls to the supported functions (standard
XQuery functions or extension
ones).Note: An
XQuery transformation is executed against a Berkeley DB XML server as a transaction
using the query transaction support of the server.
-
Run the scenario.
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
Oxygen XML Developer plugin
window, for example an XMLTYPE
value or a CLOB value, do the following actions:
- right click on that table cell
- select the action Copy cell from the popup menu for copying
the value in the clipboard
- paste the value where you need it, for example an opened XQuery editor panel of
Oxygen XML Developer plugin
.