An XML document or a collection of documents can be queried like that of an SQL database; semantically speaking. The means of performing these queries is through the language known as XQuery. While in general this is nothing more than a query language, it does also include some features associated with full-blown languages. It was the XML Query group at the World Wide Web Consortium who developed and launched XQuery 1.0 and now with the upcoming release of the XSLT 2.0 technology, the advancements and upkeep of XQuery has been turned over to that particular group at the W3C.
It was in the beginning of 2007 that XQuery first became a recommendation of the World Wide Web Consortium as it was pivotal to making sure that the new XPath 2.0 was fully-functional. Known as XML Query, the ultimate goal of the development of this technology was to allow for an improved flexibility of data extraction from both virtual as well as real documents which are available on the internet. In turn, the outcome was the ability to make an XML document function like that of a database.
With XQuery, one can not only extract data from an XML file, it is also capable of manipulating it to its needs. Furthermore, it is not just limited to XML files, but rather it can work with any type of data which is viewable in an XML format. This allows for the XML documents; or rather XML structured documents to be handled like that of a relational database.
Using the XPath expressions, the XQuery is able to find and extract various parts of an XML or XML-like document without having to load or access the remainder of the document. In completing this function, the XQuery makes use of a FLWOR type expression which stands for, “FOR, LET, WHERE, ORDER BY and RETURN. Not only can the XML documents be accessed, extracted from and manipulated, but thanks to XQuery, these documents can also be constructed as needed. The concept basically turns the XML file into a dynamic relational database for web development. It may be considered similar to that of a flat file database, however the syntax of the XQuery is much easier to learn and handle in comparison to that of say Perl.
Since the XML document is already developed using a tree-like structure in that nodes, elements and attributes can be assigned, this makes the use of XQuery very simple to manage. However, it is important to point out that as of the currently released version of the language, the ability to update both XML documents as well as databases is non existent. Seeing as though this would be one of the most sought after updates in the development, one can surely expect that XQuery 2.0 will contain this type of support.Original Authors: Nick
Edit Update Authors: M.A.Harris
Updated On: 04/03/2009