XQuery/文件传输客户端
外观
< XQuery
EXPath 文件传输客户端为 FTP 和 SFTP (SSH) 提供了通用接口。
确保以下 Jar 文件已添加到您的 $EXIST_HOME/lib/extensions
- expath-ft-client.jar
- jsch-0.1.44.jar
第一个 jar 文件是包含 XQuery 模块接口的 Java 存档文件。第二个 jar 文件是提供安全 Shell 协议支持的模块。有关更多详细信息,请参阅 http://www.jcraft.com/jsch。
<module uri="http://exist-db.org/xquery/httpclient" class="org.exist.xquery.modules.httpclient.HTTPClientModule" />
以下是文件传输客户端接口规范的临时链接
http://extxsltforms.sourceforge.net/specs/expath-ft-client/expath-ft-client.html
(: 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)
return
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>}
};