>Home>Learn XQuery>XQuery Tutorial>XQuery Introduction>Input Functions
Input Functions in XQuery
XQuery uses input functions to identify the data to be queried. There are two input functions:
- doc() returns an entire document, identifying the document by a Universal Resource Identifier (URI). To be more precise, it returns the document node.
- 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
Predefined in XQuery Entity Reference
If our sample data is in a file named books.xml, then the following query returns the entire document:
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.