eXist-db 查询:file:move 返回错误
eXist-db query: file:move returning error
我开始使用 eXide 工作,我不得不说文档很差......我找不到解决这个问题的方法:
err:XPTY0004 checking function parameter 1 in call file:move($position, $destination): XPTY0004: The actual cardinality for parameter 1 does not match the cardinality declared in the function's signature: file:move($original as item(), $destination as item()) xs:boolean. Expected cardinality: exactly one, got 0. [at line 8, column 24, source: xquery version "3.1"; import module namespace file = "http://exist-db.org/xquery/file"; let $log-in := xmldb:login('/db', 'admin', '') for $doc in collection('/db/lime-fao/fao-resolution@lime.com') let $position := document-uri($doc)[contains(., 'main.xml')] let $destination := replace($position, 'main.xml', 'main') return file:move($position,$destination)]
我做错了什么?这是查询:
xquery version "3.1";
import module namespace file = "http://exist-db.org/xquery/file";
let $log-in := xmldb:login('/db', '*********', '*********')
for $doc in collection('/db/******/******@*****.****')
let $position := document-uri($doc)[contains(., 'main.xml')]
let $destination := replace($position, 'main.xml', 'main')
return file:move($position,$destination)
谢谢。
您可以尝试以下方法。
XQuery
...
let $position := base-uri($doc)[ends-with(., 'main.xml')]
我开始使用 eXide 工作,我不得不说文档很差......我找不到解决这个问题的方法:
err:XPTY0004 checking function parameter 1 in call file:move($position, $destination): XPTY0004: The actual cardinality for parameter 1 does not match the cardinality declared in the function's signature: file:move($original as item(), $destination as item()) xs:boolean. Expected cardinality: exactly one, got 0. [at line 8, column 24, source: xquery version "3.1"; import module namespace file = "http://exist-db.org/xquery/file"; let $log-in := xmldb:login('/db', 'admin', '') for $doc in collection('/db/lime-fao/fao-resolution@lime.com') let $position := document-uri($doc)[contains(., 'main.xml')] let $destination := replace($position, 'main.xml', 'main') return file:move($position,$destination)]
我做错了什么?这是查询:
xquery version "3.1";
import module namespace file = "http://exist-db.org/xquery/file";
let $log-in := xmldb:login('/db', '*********', '*********')
for $doc in collection('/db/******/******@*****.****')
let $position := document-uri($doc)[contains(., 'main.xml')]
let $destination := replace($position, 'main.xml', 'main')
return file:move($position,$destination)
谢谢。
您可以尝试以下方法。
XQuery
...
let $position := base-uri($doc)[ends-with(., 'main.xml')]