Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 693903
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T02:48:06+00:00 2026-05-14T02:48:06+00:00

I’m having difficulty getting XQuery to work. I downloaded Saxon-HE 9.2. It seems to

  • 0

I’m having difficulty getting XQuery to work. I downloaded Saxon-HE 9.2. It seems to only want to work with XSLT.

When I type:

java -jar saxon9he.jar

I get back usage information for XSLT. When I use the command syntax for XQuery, it doesn’t recognize the parameters (like -q), and gives XSLT usage information.

Here are some command line interactions:

>java -jar saxon9he.jar
No source file name
Saxon-HE 9.2.0.6J from Saxonica
Usage: see http://www.saxonica.com/documentation/using-xsl/commandline.html
Options:
  -a                    Use xml-stylesheet PI, not -xsl argument
  -c:filename           Use compiled stylesheet from file
  -config:filename      Use configuration file
  -cr:classname         Use collection URI resolver class
  -dtd:on|off           Validate using DTD
  -expand:on|off        Expand defaults defined in schema/DTD
  -explain[:filename]   Display compiled expression tree
  -ext:on|off           Allow|Disallow external Java functions
  -im:modename          Initial mode
  -ief:class;class;...  List of integrated extension functions
  -it:template          Initial template
  -l:on|off             Line numbering for source document
  -m:classname          Use message receiver class
  -now:dateTime         Set currentDateTime
  -o:filename           Output file or directory
  -opt:0..10            Set optimization level (0=none, 10=max)
  -or:classname         Use OutputURIResolver class
  -outval:recover|fatal Handling of validation errors on result document
  -p:on|off             Recognize URI query parameters
  -r:classname          Use URIResolver class
  -repeat:N             Repeat N times for performance measurement
  -s:filename           Initial source document
  -sa                   Use schema-aware processing
  -strip:all|none|ignorable      Strip whitespace text nodes
  -t                    Display version and timing information
  -T[:classname]        Use TraceListener class
  -TJ                   Trace calls to external Java functions
  -tree:tiny|linked     Select tree model
  -traceout:file|#null  Destination for fn:trace() output
  -u                    Names are URLs not filenames
  -val:strict|lax       Validate using schema
  -versionmsg:on|off    Warn when using XSLT 1.0 stylesheet
  -warnings:silent|recover|fatal  Handling of recoverable errors
  -x:classname          Use specified SAX parser for source file
  -xi:on|off            Expand XInclude on all documents
  -xmlversion:1.0|1.1   Version of XML to be handled
  -xsd:file;file..      Additional schema documents to be loaded
  -xsdversion:1.0|1.1   Version of XML Schema to be used
  -xsiloc:on|off        Take note of xsi:schemaLocation
  -xsl:filename         Stylesheet file
  -y:classname          Use specified SAX parser for stylesheet
  --feature:value       Set configuration feature (see FeatureKeys)
  -?                    Display this message
  param=value           Set stylesheet string parameter
  +param=filename       Set stylesheet document parameter
  ?param=expression     Set stylesheet parameter using XPath
  !option=value         Set serialization option


>java -jar saxon9he.jar -q:"..\w3xQueryTut.xq"
Unknown option -q:..\w3xQueryTut.xq
Saxon-HE 9.2.0.6J from Saxonica
Usage: see http://www.saxonica.com/documentation/using-xsl/commandline.html
Options:
  -a                    Use xml-stylesheet PI, not -xsl argument
// etc...


>java net.sf.saxon.Query -q:"..\w3xQueryTut.xq"
Exception in thread "main" java.lang.NoClassDefFoundError: net/sf/saxon/Query
Caused by: java.lang.ClassNotFoundException: net.sf.saxon.Query
                 // etc...
Could not find the main class: net.sf.saxon.Query.  Program will exit.

I’m probably making some stupid mistake. Do you know what it could be?

UPDATE 1 This command does not work:

>java -jar saxon9he.jar net.sf.saxon.Query q:"..\w3xQueryTut.xq"
Source file net.sf.saxon.Query does not exist

UPDATE 2 This command works better:

>dir

03/28/2010  16:07    <DIR>          .
03/28/2010  16:07    <DIR>          ..
03/27/2010  13:37               849 books.xml
03/27/2010  13:32    <DIR>          doc
03/27/2010  13:32    <DIR>          notices
03/27/2010  13:32         5,473,874 saxon9he.jar
03/27/2010  13:38                37 w3xQueryTut.xq



>java -cp saxon9he.jar net.sf.saxon.Query q:"w3xQueryTut.xq"


java.io.FileNotFoundException: q:w3xQueryTut.xq (The system cannot find the path
 specified)
        at java.io.FileInputStream.open(Native Method)
        at java.io.FileInputStream.<init>(Unknown Source)
        at java.io.FileInputStream.<init>(Unknown Source)
        at net.sf.saxon.Query.compileQuery(Query.java:885)
        at net.sf.saxon.Query.doQuery(Query.java:183)
        at net.sf.saxon.Query.main(Query.java:89)
Fatal error during query: java.io.FileNotFoundException: q:w3xQueryTut.xq (The s
ystem cannot find the path specified)

w3xQueryTut.xq:

doc("books.xml")/bookstore/book/title

books.xml:

<?xml version="1.0" encoding="ISO-8859-1"?>

<bookstore>

<book category="COOKING">
  <title lang="en">Everyday Italian</title>
  <author>Giada De Laurentiis</author>
  <year>2005</year>
  <price>30.00</price>
</book>

<book category="CHILDREN">
  <title lang="en">Harry Potter</title>
  <author>J K. Rowling</author>
  <year>2005</year>
  <price>29.99</price>
</book>

<book category="WEB">
  <title lang="en">XQuery Kick Start</title>
  <author>James McGovern</author>
  <author>Per Bothner</author>
  <author>Kurt Cagle</author>
  <author>James Linn</author>
  <author>Vaidyanathan Nagarajan</author>
  <year>2003</year>
  <price>49.99</price>
</book>

<book category="WEB">
  <title lang="en">Learning XML</title>
  <author>Erik T. Ray</author>
  <year>2003</year>
  <price>39.95</price>
</book>

</bookstore>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T02:48:07+00:00Added an answer on May 14, 2026 at 2:48 am

    I don’t have problems with this command-line usage:

    java -cp C:\xml\Parsers\Saxon\HE-9-2-0-6\saxon9he.jar net.sf.saxon.Query
    -q:"C:\Program Files\Oxygen XML Editor 11\samples\xquery\Books\authors.xquery"

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.