0

I am using BaseX version 8.6.6 i am getting the error " expression must all be updating or return empty sequence" while updating database below is the code:

declare  %private %updating function local:ingest-job()
{
let $contentpath := 'D:\2019\bloomsbury-ingest-content\TEI.zip'
let $result := 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')),
                  <result><status>Success</status><message>Job created</message><jobid>{$jobID}</jobid></result>
                  )

 return db:output(<results>{$result}</results>)
};
Manish Joisar
  • 1,256
  • 3
  • 23
  • 47
  • This is a exact duplicate of https://stackoverflow.com/questions/58589925/no-updating-expression-allowed-basex/58603495#58603495. Please do not post the same question twice (under different accounts) – dirkk Oct 29 '19 at 08:18
  • Does this answer your question? [No updating expression allowed Basex](https://stackoverflow.com/questions/58589925/no-updating-expression-allowed-basex) – vanje Dec 02 '19 at 12:14

0 Answers0