advertisement
Premier Club Log In/Registration
  Include Code  Search Tips
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   SKILLBUILDING  |   TIP BANK  |   SOURCEBANK  |   FORUMS  |   NEWSLETTERS
Browse DevX
Download the code for this article
Partners & Affiliates
advertisement
advertisement
advertisement
Average Rating: 4.5/5 | Rate this item | 2 users have rated this item.
 

Introduction to XQuery (Part 3 of 4)

Learn how to use XQuery's FLWR (for, let where, and return) expressions to process and restructure data from one or more documents.  


 
 
 
 
advertisement
n this article, you'll explore one of the most interesting types of XQuery expressions—the FLWR expression, and see more detail on element constructors.

XQuery provides FLWR expressions for iterating over groups of nodes and for binding variables to intermediate results. The letters in the name "FLWR", pronounced "flower", stem from the keywords for, let, where, and return—the four clauses in a FLWR expression. FLWR expressions are useful for processing and restructuring data from one or more documents.


For example, the following query returns the list of email addresses of all customers in the document customers.xml.
   # see XQuery31.ixq in samples.zip
   <customers>
   { 
     for $c in document("data/customers.xml")//customer
     return
      $c/email
   }
   </customers>

The query result looks like this:
   <customers>
      <email>joe@nowhere.com</email>
      <email>andy@playallday.com</email>
      <email>amanda@areyousure.com</email>
      <email>bill@xmlforme.com</email>
   </customers>
  Next Page: FLWR Syntax and Semantics


Page 1: IntroductionPage 4: Using Joins in XQuery
Page 2: FLWR Syntax and SemanticsPage 5: Creating Element Constructors
Page 3: Variable Binding and Scoping 
Please rate this item (5=best)
 1  2  3  4  5
advertisement
Advertising Info  |   Member Services  |   Permissions  |   Contact Us  |   Help  |   Feedback  |   Site Map  |   Network Map  |   About

internet.commediabistro.comJusttechjobs.comGraphics.com

Search:

WebMediaBrands Corporate Info

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs