XQuery 3.0 is the latest version of XQuery. XQuery is the XML query language and refers to W3C specified query language for XML databases. XQuery 1.0 became a W3C Recommendation on January 23, 2007 and XQuery 3.0 became a W3C Recommendation on April 8, 2014. XQuery uses XSLT, SQL and C ajar syntax; uses XPath and XML schema for its data model and its function library. XQuery is derived from the languages ??XQL, XML-QL and Quilt.
Basics on XQuery 3.0 and XQuery
XQuery is a query language designed for data collections in XML. Is semantically similar to SQL , but includes some programming capabilities. XQuery provides the means to extract and manipulate information from XML documents or any data source that can be represented using XML, for example, relational databases or office documents. XQuery expressions uses XPath to access certain parts of the XML document. It adds, similar to those used in SQL, known as FLWOR expressions. The FLWOR expressions are named after the 5 types of sentences that can be composed: FOR, LET, WHERE, ORDER BY, and RETURN.
It also includes the ability to build new XML documents from the query results. It may use an XML-if the structure (elements and attributes) is known in advance or can be used dynamically to construct expressions. All these constructs are defined as expressions in the language, and can be arbitrarily nested. The language is based on the model tree information in the XML document, which consists of seven different types of nodes: elements, attributes, text nodes, comments, processing instructions, namespaces and document nodes.
The type system used by the language considers all values ??as strings, assuming a single value as a sequence of a single element. The elements of a sequence can be atomic values ??or nodes. Atomic values ??may be integers, strings, booleans, numbers etc. The complete list of available types is based on the primitives defined in XML Schema.
XQuery 1.0 does not include the ability to update XML documents. Nor can perform text searches. Higher-order functions first appeared in the drafts for XQuery 3.0
Applications and Implementations of XQuery 3.0
- Extracting information from a database for use in a web service.
- Generating summary reports on data stored in a XML database.
- Searching textual documents on the Web for relevant information and compiling the results.
- Selecting and transforming XML data to XHTML to be published on the Web.
- Pulling data from databases to be used for the application integration.
- Splitting up a XML document that represents multiple transactions into multiple XML documents.
Although XQuery was initially conceived as a query language for large collections of XML documents, it is also capable of transforming individual documents. As such, its capabilities overlap with XSLT, which was designed expressly to allow input XML documents to be transformed into HTML or other formats. BaseX, eXist, Saxon, Sirix, XQilla, Zorba are example projects, live demo can be found here :
This xml file :
can be converted to HTML with XQuery 3.0 :