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");


Michael Kay

From: Sweta Kedia []
Sent: 16 February 2010 10:58
Subject: [saxon] Processing String Object


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.

With Regards