Sending Queries to Tamino

The Tamino forms handler allows database queries to be automatically constructed using the values in multiple fields of an HTML form.

The commands used for building and sending a query to Tamino are very similar to those required for creating an XML document.

To compose a query and send it to Tamino, encode the following into the HTML form:

  • The name of the database and collection to be queried;

  • The fact that you want to compose a query (rather than create an XML document);

  • The query itself.

The following example illustrates the principle:

graphics/query.png

Performing a Query

Specifying the Database, Collection and Doctype

This is the same as for creating an XML document, as described above.

Composing a Query

To indicate that you want to use the HTML form to compose a query, use the following code in the HTML form:

<input type=hidden name="_HTMLreq" value="_XQL">

Specifying the Query's Nodes and Filters

A query consists of node selectors and filters. A node selector specifies the family of elements to be retrieved. A filter specifies a required subset of the elements (i.e. the part of a query that is enclosed in square brackets "[" and "]").

The node selector is specified in an HTML input statement with the following syntax:

<input type=hidden name="XQLNode" value="NodeAddress">

where NodeAddress is an XPath expression that identifies the location of the element within the document.

The filter is specified in another HTML input statement for a field that is visible in the browser.

Example

<input type=hidden name="XQLNode" value="patient">
<input type="text" size="30" name="name/surname~">

This generates a query of the form

/patient[name/surname~="ValueOfInputEntry"]

where ValueOfInputEntry stands for the value that you type in to the input field in the browser.

Note:
the "~" character in this example. This can be used to perform a search using the X-Query contains operator for the given string.