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
Average Rating: 3.5/5 | Rate this item | 2 users have rated this item.
 Print Print
 
Introduction to XQuery (Part 2 of 4)
The XQuery data model recognizes seven types of nodes. Learn how to take advantage of the data model in XQuery expressions  

 
 
 
 
advertisement
ou can find a quick introduction to the XQuery language with examples of several kinds of XQuery expressions in Part I of this series. In this part you'll explore some basic XQuery concepts.


Data Model
XQuery's data model describes the values that occur in the evaluation of a query; the inputs, outputs and intermediate values that occur during the processing of a query are all instances of the data model. The XQuery data model contains these important categories of values:

Simple Typed Values. A simple typed value conforms to a simple type as defined by the XML Schema specification, which includes strings, integers, dates etc. You can find the complete list of simple types in the XML Schema specification—Part 2.

Nodes. The XQuery data model recognizes seven types of nodes: document, element, attribute, text, comment, processing-instruction and namespace nodes. The model treats XML documents and document fragments as trees of nodes. A document is a tree with the document node as the root of the tree. Similarly a document fragment is a tree with an element at its root. Document nodes and namespace nodes have no parents. All other nodes can have zero or one parent. Only a document node or an element node can have children. Here's a simple xml document and the corresponding data model instance.

   <?xml version="1.0"?>
   <greetings>
      <!—Welcome message -->
      <welcome>Hello XQuery User</welcome>
   </greetings>

The data model instance representing this document looks like Figure 1:

Figure 1: The data model representing a simple XML document containing a <greeting> root element and a <welcome> element that holds a text message.


Sequences. A sequence is an ordered list of simple values or nodes. Sequences are flat, which means that a sequence cannot contain another sequence as its member. A sequence containing only one member is referred to as a singleton sequence. From a data model point of view, there is no distinction between a singleton sequence containing a simple value and the simple value itself.

Query Expressions. Expressions are the top-level abstraction of every element in XQuery, and are the basic building blocks of XQuery. There are several kinds of expression defined in the latest specification:

  • Constants and Variables
  • Operators
  • Path Expressions
  • FLWR (For-Let-Where-Return) expressions
  • Element/Attribute Constructors
  • Conditional expressions
  • Quantified Expressions
  • Built-in and User Defined Functions
Page 1 of 4


advertisement
  Next Page: Constants and Variables
Page 1: IntroductionPage 3: Operators
Page 2: Constants and VariablesPage 4: Path Expressions (XPath 2.0)
advertisement
Advertising Info  |   Member Services  |   Permissions  |   Contact Us  |   Help  |   Feedback  |   Site Map  |   Network Map  |   About


JupiterOnlineMedia

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info


Legal Notices, Licensing, Reprints, & Permissions, Privacy Policy.

Advertise | Newsletters | Tech Jobs | Shopping | E-mail Offers

Solutions
Whitepapers and eBooks
Microsoft Article: HyperV-The Killer Feature in WinServer ‘08
Avaya Article: How to Feed Data into the Avaya Event Processor
Microsoft Article: Install What You Need with Win Server ‘08
HP eBook: Putting the Green into IT
Whitepaper: HP Integrated Citrix XenServer for HP ProLiant Servers
Intel Go Parallel Portal: Interview with C++ Guru Herb Sutter, Part 1
Intel Go Parallel Portal: Interview with C++ Guru Herb Sutter, Part 2--The Future of Concurrency
Avaya Article: Setting Up a SIP A/S Development Environment
IBM Article: How Cool Is Your Data Center?
Microsoft Article: Managing Virtual Machines with Microsoft System Center
HP eBook: Storage Networking , Part 1
Microsoft Article: Solving Data Center Complexity with Microsoft System Center Configuration Manager 2007
MORE WHITEPAPERS, EBOOKS, AND ARTICLES
Webcasts
Intel Video: Are Multi-core Processors Here to Stay?
On-Demand Webcast: Five Virtualization Trends to Watch
HP Video: Page Cost Calculator
Intel Video: APIs for Parallel Programming
HP Webcast: Storage Is Changing Fast - Be Ready or Be Left Behind
Microsoft Silverlight Video: Creating Fading Controls with Expression Design and Expression Blend 2
MORE WEBCASTS, PODCASTS, AND VIDEOS
Downloads and eKits
Sun Download: Solaris 8 Migration Assistant
Sybase Download: SQL Anywhere Developer Edition
Red Gate Download: SQL Backup Pro and free DBA Best Practices eBook
Red Gate Download: SQL Compare Pro 6
Iron Speed Designer Application Generator
MORE DOWNLOADS, EKITS, AND FREE TRIALS
Tutorials and Demos
How-to-Article: Preparing for Hyper-Threading Technology and Dual Core Technology
eTouch PDF: Conquering the Tyranny of E-Mail and Word Processors
IBM Article: Collaborating in the High-Performance Workplace
HP Demo: StorageWorks EVA4400
Intel Featured Algorhythm: Intel Threading Building Blocks--The Pipeline Class
Microsoft How-to Article: Get Going with Silverlight and Windows Live
MORE TUTORIALS, DEMOS AND STEP-BY-STEP GUIDES