XQuery

XQuery Examples

Example

adplus-dvertising
XQuery

R4R provide basic XQuery Tutorials concept withXQuery Examples .Through R4R you can develop XQuery programming concept. R4R provide XQuery Interview Questions with answers.R4R provide XQuery Languages study materials in easy way.

Introduction of Xquery

The W3C is finalizing the XQuery specification, aiming for a final release in late 2002. XQuery is a powerful and convenient language designed for processing XML data. It is a specification for a query language that allows a user or programmer to extract information from an Extensible Markup Language (XML) file or any collection of data that can be XML-like. With XQuery, you can detect elements and their attributes inside an XML structured document and extract them

To accomplish this bit of magic, XQuery utilizes XPath expressions to locate the specified node and divide it from the other components. The syntax is intended to be easy to understand and use. Using XQuery, it is possible to view a relational database table as an XML document.

Why Xquery Used

XQuery is replacing property middleware languages and Web Application development languages. XQuery is replacing complex Java or C++ programs with a few lines of code. XQuery is simpler to work with and easier to maintain than many other alternatives.

It is used as a back end for implementing Web sites, Web project, integrating corporate data stores in the enterprise, in the XRX architecture (XForms, REST and XQuery), as well as for large publishing projects, for data mining, and for academic research. It can run on large servers and on mobile devices, as part of commercial software and as open source.

Features of XQuery

Some of the features which are present in XQuery language are as follows -

  1. Logical and physical data independence
  2. Declarative
  3. High level
  4. Side effect free
  5. Strongly typed language
Difference between XQuery and XSLT
XSLT XQuery
XSLT is document-driven XQuery is program driven
XSLT is functionalXQuery is declarative
XSLT is written in XMLXQuery is not.
XQuery 1.0 and XPath 2.0

XQuery makes use of XPath, a language that describes a way to locate and process items in XML documents. The specifications of XPath and XQuery are closely related. XQuery 1.0 derives directly from XPath 2.0. In XQuery, XPath expressions can be simple queries or parts of larger queries. XQuery has functions for numerous operations including date and time comparisons, mathematical calculations, string manipulations, and Boolean algebra.

Advantage of Xquery
  1. XQuery statements are shorter than similar SQL or XSLT programs.
  2. XQuery combines the processing power of XPath and XSLT into one consistent language.
  3. XQuery can convert XML into almost any output format, from HTML over XHTML to WML, SVG, SMIL, etc. This allows support not only for HTML clients but also for mobile clients, and for multimedia applications.
  4. User-definable XQuery functions allow for modular query expressions.
  5. The XML Schema type system and namespaces are fully supported.
  6. XQuery 4 features easy-to-read SQL-like syntax. An alternative syntax (XQueryX) allows the formulation of queries as XML documents. XQuery 4 also supports insert, update and delete operations.
  7. XQuery can query both hierarchical and tabular data.
  8. XQuery has a consistent syntax and can be used with other XML standards such as XML Schema datatypes.
  9. XQuery can query many different data structures and its recursive nature makes it ideal for querying tree and graph structures.
  10. XQuery can be learned by anyone familiar with SQL.
  11. Both XQuery and SQL have easy ways to select distinct values from a result set.
Disadvantage of Xquery

XQuery 1.0 is not yet a W3C Recommendation. Tamino's XQuery 4 supports a subset of the W3C XQuery Working Draft. Currently, no WYSIWYG editors exist that can produce XQuery from a web page design. The same is true for QbE (Query by Example) front-ends.

XQUERY Tutorials
XQUERY Examples
XQUERY Interview Materials