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;

&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.

Prev: "Literals and Comments"

Next: "Locating Nodes"

Email Print Share

XQuery: A Guided Tour

Progress DataDirect Resource Library If you like this Tutorial, you'll love the others!

Be sure to visit the Progress DataDirect Resource Library regularly because we are continually adding new Tutorials.