我正在使用 BaseX 版本 8.6.6 我在更新数据库时遇到错误
表达式必须全部更新或返回空序列
下面是代码:
declare %private %updating function local:ingest-job()
{
let $contentpath := 'D:\2019\bloomsbury-ingest-content\TEI.zip'
let $archive := file:read-binary($contentpath)
for $entry in archive:entries($archive)[fn:ends-with(., '.xml')]
let $rootNode := fn:name(fn:parse-xml(archive:extract-text($archive, $entry))/*)
return
let $docId := fn:parse-xml(archive:extract-text($archive, $entry))/*/@xml:id/string()[$rootNode='TEI']
let $cid := fn:replace($docId,'[a-zA-z-]','')
let $jobID := fn:concat($cid,'-',fn:string(fn:format-dateTime(fn:current-dateTime(), '[Y0001][M01][D01][H01][m01][s01][f01]')))
let $jobChunk := <job>
<job-info>
<id>{$jobID}</id>
<cid>{$cid}</cid>
</job-info>
</job>
return
(
db:add('testdb',$jobChunk,fn:concat('/jobs/',$jobID,'.xml')),
db:output( <result><status>Success</status><message>Job created</message><jobid>{$jobID}</jobid></result>)
)
};
<results>{local:ingest-job()}</results>
电流输出:
<result>
<status>Success</status>
<message>Job created</message>
<jobid>9781784604387-2019102816303069</jobid>
</result>
<result>
<status>Success</status>
<message>Job created</message>
<jobid>9781784604417-2019102816303069</jobid>
</result>
预期输出:
<results>
<result>
<status>Success</status>
<message>Job created</message>
<jobid>9781784604387-2019102816303069</jobid>
</result>
<result>
<status>Success</status>
<message>Job created</message>
<jobid>9781784604417-2019102816303069</jobid>
</result>
</results>
这里出了什么问题?