The s9api interface (at least for Saxon-EE) has facilities that allow you to compile a library module independently of a main module, but XQJ does not. You need to present it with a main module that imports the library module.

Michael Kay
Saxonica

On 05/04/2011 13:16, Kunal Chauhan wrote:
hello all,
 
I wrote some xqueries and I declared some function for it.
I made seprated xq file for those functions.
I tried and run it in stylus studio it's all set.
 
But now I want to Implement it in java through  XQJ.
but when I try to load that xq file I am getting some error.
 
please guide me to solve those errors.
 
here is my xq file
 
module namespace m1 = 'http://m1.org';

declare function m1:getMsg() as xs:string *{

let $msg := 'Hello World'
return $msg

};
 
here is java file
 

public

static void main(String args[])

{

SaxonXQConnection con= (SaxonXQConnection) XQueryConnection.getConnection();

try{

String filepath=

"D:/XqueryRnD/XQuery19.xquery";

SaxonXQPreparedExpression exp = (SaxonXQPreparedExpression)con.prepareExpression(

new FileInputStream(filepath));

XQSequence result=exp.executeQuery();

}

catch(Exception e){

e.printStackTrace();

}

}

I am getting following errors

Error on line 1 column 0

XPST0003: XQuery syntax error in #module namespace m1#:

Module declaration must not be used in a main module

Error on line 3 column 18

XPST0081: XQuery static error in #... declare function m1:getMsg()#:

Prefix m1 has not been declared

Error on line 8 column 3

XPST0003: XQuery syntax error in #... 'Hello World' return $msg };#:

Unexpected token "<eof>" in path expression

 

 

 


--
Kunal Chauhan
mail4ck@gmail.com
[+918655517141]
[+919904983614]

------------------------------------------------------------------------------ Xperia(TM) PLAY It's a major breakthrough. An authentic gaming smartphone on the nation's most reliable network. And it wants your games. http://p.sf.net/sfu/verizon-sfdev
_______________________________________________ saxon-help mailing list archived at http://saxon.markmail.org/ saxon-help@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/saxon-help