XQuery (XML Query) is a query and functional programming language designed for querying and transforming collections of data, typically XML data.
• It is a standardized language that provides a powerful and flexible way to interact with XML documents.
• XQuery for XML is like SQL for databases
• XQuery is part of the XML family of technologies and is developed by the World Wide Web Consortium (W3C).
XQuery Basic Syntax Rules:
Some basic syntax rules:
- XQuery is case-sensitive
- XQuery elements, attributes, and variables must be valid XML names
- An XQuery string value can be in single or double quotes
- An XQuery variable is defined with a $ followed by a name, e.g. $bookstore
- XQuery comments are delimited by (: and :), e.g. (: XQuery Comment 🙂
Features:
• XQuery is primarily used for querying and extracting information from XML documents.
• XQuery is a functional programming language, which means it treats computation as the evaluation of mathematical functions.
• XQuery incorporates XPath expressions for navigating XML structures. XPath is used to identify nodes and relationships within an XML document.
• XQuery uses FLWOR expressions (For, Let, Where, Order by, Return) to construct queries.
Use of XQuery:
XQuery can be used to:
- Extract information to use in a Web Service
- Generate summary reports
- Transform XML data to XHTML
- Search Web documents for relevant information