您好我正在進行攝入和驗證,但我想記錄攝取和驗證的開始時間和結束時間。下面是我的代碼,我做錯了,請建議。如何在BaseX中記錄任務開始時間和任務結束時間
let $pipelineXml :=
<pipeline id='a111' name='ACH-export' xmlns='http://cms.bloomsbury.com/pipeline'>
<transform href='/transforms/docbook2xml.xsl'/>
<validate href='/validation/taxonomy.sch' failOnError='true'/>
</pipeline>
let $reportChunk := <report>
<info>
<id>{$pipelineXml//@id}</id>
<name>{$pipelineXml//@name}</name>
<submitted-on>{fn:current-dateTime()}</submitted-on>
<user>{user:current()}</user>
</info>
<ingestion-report>
<steps/>
</ingestion-report>
</report>
let $startTime := fn:current-dateTime()
let $validate := validate:rng-report($pipelineXml, bin:decode-string(db:retrieve($config:Database, fn:concat($config:ValidationDir,$config:PipelineRelaxNG)),'UTF-8'), fn:true())
return
if($validate/status='valid')
then
(
admin:write-log("[" || "][Pipeline is valid as per Relax NG : " || $pipelineXml//@id || "]")
,
let $appendReport := let $updateReport := <step>
<type>RELAX NG Validation</type>
<started-on>{$startTime,prof:sleep(20000)}</started-on>
<completed-on>{fn:current-dateTime()}</completed-on>
<status>Pass</status>
<error></error>
</step>
return
copy $target := $reportChunk
modify insert node $updateReport as last into $target/ingestion-report/steps
return $target
return $appendReport
)
else "error"
謝謝您的回覆Michael,但我的要求是存儲時間格式爲 2017-09-04T17:17:14.989 + 05:30 2017-09-04T17:17:14.989 + 05: 30 completion-on>只有這樣我才能實現這個在當前的代碼,如果你在這個非常讚賞的幫助 –
我得到的解決方案感謝指南邁克爾:我已經取代只有FN:當前日期時間調整-dateTime-to-timezone(convert:integer-to-dateTime(prof:current-ms())) –
好的:-)如果有幫助,你可以考慮接受我的答案https://meta.stackexchange.com/questions/5234 /如何-不接受-的回答工作 – michael