XQuery/File Transfer Client

File Transfer ClientEdit

The EXPath File Transfer Client provides a common interface for both FTP and SFTP (SSH).


Make sure that the following Jar files have been added to your $EXIST_HOME/lib/extensions:

  • expath-ft-client.jar
  • jsch-0.1.44.jar

The first jar file is the Java Archive file that contains the XQuery module interfaces. The second jar file is the module that provides the Secure Shell protocol support. See http://www.jcraft.com/jschfor further details.

<module uri="http://exist-db.org/xquery/httpclient" class="org.exist.xquery.modules.httpclient.HTTPClientModule" />

The following is a temporary link to the File Transfer client interface specification:


Getting remote XML filesEdit

(: this is a safe version of get remote XML file and parse :)
declare function local:get-remote-file-safe($connection as xs:long, $path as xs:string) as node() {
let $binary-file := ft-client:retrieve-resource($connection, $path)
let $string-of-file := util:binary-to-string($binary-file)
try {util:parse($string-of-file)}
        catch exerr:EXXQDY0002 {<error>The input file is not well formed.</error>}
        catch * {<error>Unknown parse error on input file.  The input could not be parsed.</error>}