XQuery Tutorial
Selected Reading
- XQuery - Discussion
- XQuery - Useful Resources
- XQuery - Quick Guide
- XQuery - Custom Functions
- XQuery - If Then Else
- XQuery - Regular Expressions
- XQuery - Date Functions
- XQuery - String functions
- XQuery - Sequence Functions
- XQuery - Sequences
- XQuery - XPath
- XQuery - HTML Format
- XQuery - FLWOR
- XQuery - First Application
- XQuery - Environment Setup
- XQuery - Overview
- XQuery - Home
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
XQuery - FLWOR
XQuery - FLWOR
FLWOR是一个缩略语,可称为“在什么地方,由回归令”。 The following pst show what they account for in a FLWOR expression -
Example
以下是XML文件样本,其中载有收集书籍的资料。 我们将使用FLWOR的表述,以超过30美元的价格收回这些书籍的标题。
books.xml
<?xml version="1.0" encoding="UTF-8"?> <books> <book category="JAVA"> <title lang="en">Learn Java in 24 Hours</title> <author>Robert</author> <year>2005</year> <price>30.00</price> </book> <book category="DOTNET"> <title lang="en">Learn .Net in 24 hours</title> <author>Peter</author> <year>2011</year> <price>70.50</price> </book> <book category="XML"> <title lang="en">Learn XQuery in 24 hours</title> <author>Robert</author> <author>Peter</author> <year>2013</year> <price>50.00</price> </book> <book category="XML"> <title lang="en">Learn XPath in 24 hours</title> <author>Jay Ban</author> <year>2010</year> <price>16.50</price> </book> </books>
The following Xquery document contained the query expression to be committed on the above XML document.
books.xqy
let $books := (doc("books.xml")/books/book) return <results> { for $x in $books where $x/price>30 order by $x/price return $x/title } </results>
Result
<title lang="en">Learn XQuery in 24 hours</title> <title lang="en">Learn .Net in 24 hours</title>
Verify Result
为核实结果,取代books.xqy。 (见
Advertisements