XQuery First Example
Here, the XML document is named as courses.xml and xqy file is named as courses.xqy
courses.xml
courses.xqy
This example will display the title elements of the courses whose fees are greater than 5000.
Create a Java based XQuery executor program to read the courses.xqy, passes it to the XQuery expression processor, and executes the expression. After that the result will be displayed.
XQueryTester.java
Execute XQuery against XML
Put the above three files to a same location. We put them on desktop in a folder name XQuery2. Compile XQueryTester.java using console. You must have JDK 1.5 or later installed on your computer and classpaths are configured.
Compile:
javac XQueryTester.java
Execute:
java XQueryTester
Output:
Next TopicXQuery FLWOR