25.12.2013 Views

Tamino XQuery User Guide - Software AG Documentation

Tamino XQuery User Guide - Software AG Documentation

Tamino XQuery User Guide - Software AG Documentation

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Advanced Usage<br />

declare namespace ino="http://namespaces.softwareag.com/tamino/response2"<br />

root(<br />

for $a in collection("ino:source")/ino:module<br />

where $a/@ino:targetNamespace="http://www.examples.com/tree"<br />

return $a<br />

)<br />

The query functions defined in an <strong>XQuery</strong> module may also be used for defining a computed index.<br />

For details on computed indexes please refer to Performance <strong>Guide</strong> > Advanced Indexes.<br />

The <strong>XQuery</strong> Tool delivered with <strong>Tamino</strong> provides convenient support for maintaining <strong>XQuery</strong><br />

modules.<br />

Serializing Query Results<br />

When <strong>Tamino</strong> executes a query, it handles the query in terms of its data model: an XML document<br />

is treated as a tree with a document root and different types of nodes. The query result is then<br />

serialized and wrapped into a <strong>Tamino</strong> response document. You can determine the serialization by<br />

using a <strong>Tamino</strong> query pragma, or <strong>XQuery</strong> processing instruction, which always has the form<br />

{?piname?}. Like a regular XML processing instruction, it can have additional information. This<br />

section discusses the available serializations:<br />

■ Suppressing the Response Wrapper<br />

■ Setting the MIME Media Type<br />

■ Defining a Custom Output Handler<br />

Suppressing the Response Wrapper<br />

Normally, when <strong>Tamino</strong> executes a query, it returns the result using a response wrapper. This is<br />

the result of the very first query in this manual:<br />

80<br />

<strong>XQuery</strong> <strong>User</strong> <strong>Guide</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!