HTML tutorial
CSS3 tutorial
Bootstrap tutorial
JavaScript tutorial
JQuery tutorial
AngularJS tutorial
React tutorial
NodeJS tutorial
PHP tutorial
Python tutorial
Python3 tutorial
Django tutorial
Linux tutorial
Docker tutorial
Ruby tutorial
Java tutorial
C tutorial
C ++ tutorial
Perl tutorial
JSP tutorial
Lua tutorial
Scala tutorial
Go tutorial
ASP.NET tutorial
C # tutorial
In this section, let us learn by studying an example to some basic XQuery syntax.
We will use this XML document in the examples below.
"Books.xml":
See "books.xml" file in your browser .
XQuery uses functions to extract data from the XML document.
doc () is used to open "books.xml" file:
XQuery uses path expressions to navigate in XML documents through the elements.
The following path expression for "books.xml" select all files in the title element:
(/ Bookstore select bookstore element, / book Selects all book elements under the bookstore element, and / title Selects all title elements under each book element)
The above XQuery can extract the following data:
XQuery uses predicates to define an XML document from the extracted data.
The following predicate is used to select all book elements under the bookstore element, and the value of the price element selected book element under 30 must be less than:
The above XQuery can be extracted to the following data: