I think it's likely that the QName you are passing is the wrong kind of QName. There are a number of Java classes called QName in different packages. Check that you are using the one expected by the XQJ interface.
 

Regards,

Michael Kay
http://www.saxonica.com/
http://twitter.com/michaelhkay



From: Sweta Kedia [mailto:swetakedia@gmail.com]
Sent: 15 February 2010 06:50
To: saxon-help@lists.sourceforge.net
Subject: Re: [saxon] saxon-help Digest, Vol 45, Issue 16

Hi Michael,

I was  using Saxon home edition 9.2.x  but still I upgraded to 9.2.0.5.

When I am using null, the compilation error I am getting is:

Exception in thread "main" java.lang.Error: Unresolved compilation problem:
    The method bindString(QName, String, XQItemType) in the type SaxonXQDynamicContext is not applicable for the arguments (QName, String, null)


and then I tried to use any XQItemType as:

expr.bindString(new QName("labelLinkUri"),"C:/
Users/A/Documents/Sweta/users/sweta231119791251796126671/Other/2008/Quarterly/2nd Quarterly/bvf-20081231/bvf-20081231_lab.xml",
                    con.createAtomicType(XQItemType.XQBASETYPE_ANYATOMICTYPE));

then I am getting compilation error as:

Exception in thread "main" java.lang.Error: Unresolved compilation problem:
    The method bindString(QName, String, XQItemType) in the type SaxonXQDynamicContext is not applicable for the arguments (QName, String, XQItemType).


And here is my code sample:


SaxonXQConnection con = (SaxonXQConnection) xqueryConnection.getConnection();
rule2= new FileInputStream(currDirectory+"/xqFiles/Rule2.xq");


            SaxonXQPreparedExpression expr = (SaxonXQPreparedExpression) con.prepareExpression(rule2);
            expr.bindString(new QName("labelLinkUri"),"C:/Users/A/Documents/Sweta/users/sweta231119791251796126671/Other/2008/Quarterly/2nd Quarterly/bvf-20081231/bvf-20081231_lab.xml",null);
           
            XQResultSequence rs = expr.executeQuery();
            while (rs.next()) {
           
            SaxonXQItem item = (SaxonXQItem) rs.getItem();
           
           
            if(item.getSaxonItem() instanceof NodeInfo){
                NodeInfo node= (NodeInfo)item.getSaxonItem();
             
                System.out.println("Error in line number  " +node.getLineNumber()+" = " +item.getItemAsString(null).toString());
               
            }
            else if(item.getSaxonItem() instanceof AtomicValue){
            System.err.println("Validation Error in File :"+ item.getAtomicValue());
            }
           
        }
        rs.close();
        con.close();


Thanks and Regards
Sweta


On Sun, Feb 14, 2010 at 11:47 PM, <saxon-help-request@lists.sourceforge.net> wrote:
Send saxon-help mailing list submissions to
       saxon-help@lists.sourceforge.net

To subscribe or unsubscribe via the World Wide Web, visit
       https://lists.sourceforge.net/lists/listinfo/saxon-help
or, via email, send a message with subject or body 'help' to
       saxon-help-request@lists.sourceforge.net

You can reach the person managing the list at
       saxon-help-owner@lists.sourceforge.net

When replying, please edit your Subject line so it is more specific
than "Re: Contents of saxon-help digest..."


Today's Topics:

  1. Re: How can I dynamically pass filename to xquery Files.
     (Sweta Kedia)
  2. Re: How can I dynamically pass filename to xquery Files.
     (Michael Kay)
  3. Re: Problem in Update using Saxon - URGENT !! (Abhisek Bhowmik)


----------------------------------------------------------------------

Message: 1
Date: Sat, 13 Feb 2010 11:24:36 +0530
From: Sweta Kedia <swetakedia@gmail.com>
Subject: Re: [saxon] How can I dynamically pass filename to xquery
       Files.
To: saxon-help@lists.sourceforge.net
Message-ID:
       <5cd259e51002122154o561b7e70lee03dc92ba58dd1b@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

Hi,

I am trying to bind the string as you suggested with

expr.bindString(new QName("labelLinkUri"),
"file:///c:/Users/A/Documents/
Sweta..../xyz.xml", null).

But it is not accepting null as XQItemType parameter.
Please tell where I am going wrong.

Thanks.
With Regards
Sweta





Message: 3
Date: Thu, 11 Feb 2010 08:37:45 -0000
From: "Michael Kay" <mike@saxonica.com>
Subject: Re: [saxon] How can I dynamically pass filename to xquery
      Files.
To: "'Mailing list for the SAXON XSLT and XQuery processor'"
      <saxon-help@lists.sourceforge.net>
Message-ID: <
112FDF0C698A41F1AB95CDE008B5C10B@Sealion>
Content-Type: text/plain; charset="us-ascii"

You can declare an external variable in your query like this:

declare variable $labelLinkUri as xs:string external;

You can then reference the variable like this:

let $x := doc($labelLinkUri) return ...

And then you can bind a value to the variable in your XQJ application code
as:

expr.bindString(new QName("labelLinkUri"),
"file:///c:/Users/A/Documents/Sweta..../xyz.xml", null)

Note that XQuery expects to deal with URIs, not file names.

Regards,

Michael Kay
http://www.saxonica.com/
http://twitter.com/michaelhkay




Message: 2
Date: Thu, 11 Feb 2010 10:42:34 +0530
From: Sweta Kedia <swetakedia@gmail.com>
Subject: [saxon] How can I dynamically pass filename to xquery Files.
To: saxon-help@lists.sourceforge.net
Message-ID:
      <5cd259e51002102112n1289fa4cpcc6af77e9c34de6f@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

Hi,

I have a separate xquery file which I am calling through java as follows:

rule2= new
FileInputStream("C:/Users/A/
workspace/Validator/xqFiles/Rule2.xq");
 SaxonXQPreparedExpression expr = (SaxonXQPreparedExpression)
con.prepareExpression(rule2);

 In Rule2.xq I have some filepaths as:


let
$labelLinkFile:="C:/Users/A/Documents/Sweta/users/sweta231119791251796126671/Other/2008/Quarterly/2nd
Quarterly/bvf-20081231/bvf-20081231_lab.xml"
let $x:=
fn:doc("C:/Users/A/Documents/Sweta/users/sweta231119791251796126671/Other/2008/Quarterly/2nd
Quarterly/bvf-20081231/bvf-20081231.xml")//*[@contextRef and @unitRef]
let $pre:=
fn:doc("C:/Users/A/Documents/Sweta/users/sweta231119791251796126671/Other/2008/Quarterly/2nd
Quarterly/bvf-20081231/bvf-20081231_pre.xml")/linkbase/presentationLink

I want that these filepath should be dynamically passed through java.
Please tell me how can this be done.

With Regards

Sweta.
-------------- next part --------------
An HTML attachment was scrubbed...
-------------- next part --------------
An HTML attachment was scrubbed...

------------------------------

Message: 2
Date: Sat, 13 Feb 2010 11:11:00 -0000
From: "Michael Kay" <mike@saxonica.com>
Subject: Re: [saxon] How can I dynamically pass filename to xquery
       Files.
To: "'Mailing list for the SAXON XSLT and XQuery processor'"
       <saxon-help@lists.sourceforge.net>
Message-ID: <3E8CDB68F8CC465A9B286EFD8B776FA7@Sealion>
Content-Type: text/plain; charset="us-ascii"

I've got several test cases for this interface that pass a null value for
the XQItemType successfully. Could you please

(a) check/confirm that you are using the latest version (9.2.0.5, though any
9.2.x release should be OK)

(b) supply a minimal test case to demonstrate the failure.

Regards,

Michael Kay
http://www.saxonica.com/
http://twitter.com/michaelhkay


 _____

From: Sweta Kedia [mailto:swetakedia@gmail.com]
Sent: 13 February 2010 05:55
To: saxon-help@lists.sourceforge.net
Subject: Re: [saxon] How can I dynamically pass filename to xquery Files.


Hi,

I am trying to bind the string as you suggested with

expr.bindString(new QName("labelLinkUri"),
"file:///c:/Users/A/Documents/
Sweta..../xyz.xml", null).

But it is not accepting null as XQItemType parameter.
Please tell where I am going wrong.

Thanks.
With Regards
Sweta






Message: 3
Date: Thu, 11 Feb 2010 08:37:45 -0000
From: "Michael Kay" <mike@saxonica.com>
Subject: Re: [saxon] How can I dynamically pass filename to xquery
      Files.
To: "'Mailing list for the SAXON XSLT and XQuery processor'"
      <saxon-help@lists.sourceforge.net>
Message-ID: <
112FDF0C698A41F1AB95CDE008B5C10B@Sealion>
Content-Type: text/plain; charset="us-ascii"

You can declare an external variable in your query like this:

declare variable $labelLinkUri as xs:string external;

You can then reference the variable like this:

let $x := doc($labelLinkUri) return ...

And then you can bind a value to the variable in your XQJ application code
as:

expr.bindString(new QName("labelLinkUri"),
"file:///c:/Users/A/Documents/Sweta..../xyz.xml", null)

Note that XQuery expects to deal with URIs, not file names.

Regards,

Michael Kay
http://www.saxonica.com/
http://twitter.com/michaelhkay





Message: 2
Date: Thu, 11 Feb 2010 10:42:34 +0530
From: Sweta Kedia <swetakedia@gmail.com>
Subject: [saxon] How can I dynamically pass filename to xquery Files.
To: saxon-help@lists.sourceforge.net
Message-ID:
      <5cd259e51002102112n1289fa4cpcc6af77e9c34de6f@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

Hi,

I have a separate xquery file which I am calling through java as follows:

rule2= new
FileInputStream("C:/Users/A/
workspace/Validator/xqFiles/Rule2.xq");
 SaxonXQPreparedExpression expr = (SaxonXQPreparedExpression)
con.prepareExpression(rule2);

 In Rule2.xq I have some filepaths as:


let
$labelLinkFile:="C:/Users/A/Documents/Sweta/users/sweta231119791251796126671
/Other/2008/Quarterly/2nd
Quarterly/bvf-20081231/bvf-20081231_lab.xml"
let $x:=
fn:doc("C:/Users/A/Documents/Sweta/users/sweta231119791251796126671/Other/20
08/Quarterly/2nd
Quarterly/bvf-20081231/bvf-20081231.xml")//*[@contextRef and @unitRef]
let $pre:=
fn:doc("C:/Users/A/Documents/Sweta/users/sweta231119791251796126671/Other/20
08/Quarterly/2nd
Quarterly/bvf-20081231/bvf-20081231_pre.xml")/linkbase/presentationLink

I want that these filepath should be dynamically passed through java.
Please tell me how can this be done.

With Regards

Sweta.
******************************************