BizTalk Utilities CV ,   Jobs ,   Code library  
 
Home Page
XQuery
Programming with XQuery classes
XQuery Demo namespace
XQuery Demo
What is XQuery and ASP.NET?
What is XQuery?
Why do I need XQuery when I already have XSLT/XPath?
XQuery 1.0 syntax types and some query examples.
How to use XQuery in ASP.NET
Learn XQuery 1.0 fundamentals
<< XmlSerializer
XSLT >>

By :Mark Wilson
I am the creator of TopXML. I am available for international and local (Australia) contracts. I am a Solution Architect/Business Analyst. I have worked in IT in several countries (NZ, Australia, South Africa, UK) building and training teams for government and very large non-governmental organizations. I am ex-Microsoft Consulting Services. I wrote the first book on Microsoft XML published in 2000 called XML Programming with VB and ASP. Most recently I have been building tools for the SEO industry. Ask me for a 37 point SEO health-checkup for your website.
First posted :03/24/2008
Times viewed :213

 

XQuery Primary Expressions

XQuery basically consist of two languages: the first is XQuery, a human-readable version, which is actually not XML, and the second is called XQueryX, the XML version of XQuery, which is intended to be used by (automating) applications rather than by human beings. In this tutorial however, we'll only look at the human-readable version.

XQuery consists of a set of powerful expressions. What kind of expressions does XQuery offer? There are Primary Expressions, Path Expressions, Sequence Expressions, Arithmetic Expressions, Comparison Expressions, Logical Expressions, Constructors, FLWR Expressions, Sorting Expressions, Conditional Expressions, and Quantified Expressions, and some more.

The following sections contain worksheets that will let you enter some example xqueries constructed using expression types, and run them over the XML source provided earlier in this tutorial. I recommend you get the XQueryTester up and running before continuing…

Primary Expressions

This group of expressions consists of literals, variables, parenthesized expressions, function calls, and comments.

Each following expression type makes use of these primary expressions.

I guess that a short explanation of each of the contained expressions is in place here. First, a literal consists of two types: numerical literals and string literals.

Numerical literals can contain integers, decimals, and doubles. They respectively evaluate to the data types xs:integer, xs:decimal, and xs:double. All three types contain series of digits in conjunction with representation methods for each data type.

String literals are a series of concatenated chars, enclosed by either single or double quotes. Its type evaluates to xs:string. A literal of zero characters is called an empty string.

In XQuery, variable expressions evaluate to the value of their QName, which is dependent of the evaluation context. XQuery allows static and dynamic variables to be used. Variables must be declared before they are used. More information on the term QName may be found at: http://www.w3.org/TR/REC-xml-names/#NT-QName

Parenthesized expressions are simply expressions contained in double quotes.

Function calls contain a QName (i.e., a variable which evaluates to a function calls’ name) and a parenthesized list of one or more expressions. Currently, unfortunately the MS XQuery Demo does not yet support any function call other than document().

Finally, comments are simply text strings enclosed in xqueries and are ignored by the XQuery processor.

No explicit examples are included here since these expression types are in fact the basic building blocks for use in all other XQuery Expression types that follow. So hold on, and you’ll soon see some basic xqueries appearing, that consist of combinations of the primary expressions mentioned above.


Rate this article on a scale of 1 to 10

Your vote :  


 

Recent Jobs

An immediate job opportunity as a B
Software Developers Needed in Charl
Sr. Software Engineer - Analytics
Immediate Mainframe openings for Ch
Immediate TANDEM-TAL openings for C

View all Jobs (Add yours)
View all CV (Add yours)



answering service
fax server
swimming pool contractor
halloween mask
water softener
Teleconference
Host Department NOLIMIT Web Hosting
MSN
sunglasses


    Email TopXML  

Front Page Daily Stuff TopXML Forum XML blogs XML Newsgroups BizTalk Biztalk Utilities Biztalk Utilities Tutorial B2B SAP XML Microsoft .NET Dotnet System XML Soapformatter SQLXML XMLserializer XQuery PHP PHP SimpleXML PHP XML Dom PHP XML RPC PHP XSLT Java Java Java XML Xalan Microsoft ASP ASP Schemas XML SQL Server XML XMLDom XSL XSL Tutorial XSLT Stylesheets General Javascript CSS XHTML WAP