The simplest approach is to pass the URI of the file as a parameter to the query, and then read the file within the query using the doc() function.
 
In the query:
 
declare external variable fileUri as xs:string;
 
.... doc($fileUri) ...
 
In the Java application, depending which API you are using, something like
 
queryEvaluator.setParameter(new QName("", "fileUri"), "file:///c:/some/dir/file.xml");
 

Regards,

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



From: Sweta Kedia [mailto:swetakedia@gmail.com]
Sent: 16 February 2010 10:58
To: saxon-help@lists.sourceforge.net
Subject: [saxon] Processing String Object

Hi,

I want to convert a xml file into a java String Object and give this Object to my xquery expression. How can I do this.

Pls help.


Thanks.
With Regards
Sweta