| HTML Tutorials |
|
|
| XML Tutorials |
|
|
| Browser Scripting |
|
|
| Server Scripting |
|
|
| .NET (dotnet) |
|
|
| Multimedia |
|
|
| Web Building |
|
|
| Java Tutorials |
|
|
| Programming Langauges |
|
|
| Soft Skills |
|
|
|
|
XQuery is case-sensitive and XQuery elements, attributes, and variables must have valid XML names.
|
|
XQuery Basic Syntax Rules
|
|
Some basic syntax rules:
- XQuery is case-sensitive one
- XQuery elements, attributes, and variables must have valid
XML names
- An XQuery string value can be in the single or double quotes
- An XQuery variable is defined with a $ sign followed by a
name, e.g. $bookstore
- XQuery comments are always delimited by (: and :), e.g. (:
XQuery Comment :)
|
|
XQuery Conditional Expressions
|
|
"If-Then-Else" expression are allowed in XQuery.
Look at the example which is given below:
|
for $x in doc("books.xml")/bookstore/book
return if ($x/@category="CHILDREN")
then <child>{data($x/title)}</child>
else <adult>{data($x/title)}</adult>
|
|
|
Notes on the "if-then-else" syntax: parentheses
around the if expression are always required. else is required, but it
can be just else ().
The result of an example above will be:
|
<adult>Everyday Italian</adult>
<child>Harry Potter</child>
<adult>Learning XML</adult>
<adult>XQuery Kick Start</adult>
|
|
|
XQuery Comparisons
|
|
There are two ways of comparing values are available in XQuery.
1. General comparisons: =, !=, >, >=, <, <=
2. Value comparisons: eq, ne, gt, ge,lt,le,
The difference between the two comparison methods are given below.
Look at the XQuery expressions which is given below:
|
$bookstore//book/@q > 10
The expression above returns true if any q attributes
have values greater than 10.
$bookstore//book/@q gt 10
The expression above returns true if there is only one
q attribute returned by the expression, and its value
is greater than 10. If more than one q is returned,
an error occurs.
|
|
Share And Enjoy:These icons link to social bookmarking sites where readers can share and discover new web pages.
Keywords:
xquery syntax ,xpath syntax,xpath query syntax ,xquery tutorial,xquery example,c# xquery,xquery examples ,xquery xpath,xquery namespace,oracle xquery ,xquery attribute ,xquery count ,xquery sql ,xquery functions,xquery join ,xquery xml,xquery update,query document,xhtml syntax,xquery contains,xquery multiple,xquery string
|
|
| HTML Quizes |
|
|
| XML Quizes |
|
|
| Browser Scripting Quizes |
|
|
| Server Scripting Quizes |
|
|
| .NET (dotnet) Quizes |
|
|
| Multimedia Quizes |
|
|
| Web Building Quizes |
|
|
| Java Quizes |
|
|
| Programming Langauges Quizes |
|
|
| Soft Skills Quizes |
|
|
|