Input Functions in XQuery

XQuery uses input functions to identify the data to be queried. There are two input functions:

  1. doc() returns an entire document, identifying the document by a Universal Resource Identifier (URI). To be more precise, it returns the document node.
  2. collection() returns a collection, which is any sequence of nodes that is associated with a URI. This is often used to identify a database to be used in a query.

TABLE 1.1 Entity References

Character Represented

Predefined in XQuery Entity Reference

 

<

<

&gt;

>

&amp;

&

&quot;

"

&apos;

'

If our sample data is in a file named books.xml, then the following query returns the entire document:

doc("books.xml")

A dynamic error is raised if the doc() function is not able to locate the specified document or the collection() function is not able to locate the specified collection.

Stay Informed!

XQuery is one of the hottest XML technologies being developed today. Stay informed with vital news about standards, tools, and trends by signing up for the DataDirect XQuery® newsletter.

Back to School with DataDirect XQuery®

Getting your mind around the possibilities of a data integration technology as promising as XQuery can be difficult, but our XML developers Webinars will help you understand the power and versatility of XQuery, and our favorite XQuery processor, DataDirect XQuery®.

From information about how to leverage relational data to real-world use cases, our Webinars will help you see why DataDirect XQuery® is the best choice for today's tough data integration and aggregation challenges.

Use DataDirect XQuery® to Mine Relational Data!

This informative XQuery webinar shows you how scalable, flexible, and reliable DataDirect XQuery® is for building XML applications that access data from relational databases, XML, Web services and legacy formats; and how it uses document projection and data streaming technologies to efficiently query large (Gigabytes) XML documents.

Check our XQuery Webinars page for more information on this and other Webinar topics.