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>}
};