trigger validation
Eduard Drenth <[email protected]>
| Newsgroups | gmane.text.xml.exist |
|---|---|
| Message-ID | <AS4P189MB230487749BA7FF0C40F33E1DF1A19@AS4P189MB2304.EURP189.PROD.OUTLOOK.COM> |
Dear all,
I want to implement validating a document via a before-update-document trigger.
When validation fails I want the update to fail and I want to provide the caller with feedback.
I wrote this function:
declare function local:validate($uri as xs:string) {
let $report := validation:jing-report(xs:anyURI($uri), doc("xmldb:exist:///db/apps/corpora/schematron/corpora_linguistics.sch"))
return if ($report/status='invalid') then
(
util:log('warn',$report/message),
error(QName('http://corpora.fa','invalid'))
)
else ()
};
It does the job sort of, but:
1. the currently stored document is validated, not the user input
2. I found no option to get $report/message back to the user (in eXide)
I could perhaps remember the current document in before-update-document and when validation fails in after-update-document restore the documment, but that seems a bit tricky perhaps.
Does any of you have experience with such a scenario?
Eduard Drenth, Software Architekt
[email protected]
Doelestrjitte 8
8911 DX Ljouwert
(058) 213 14 14
+31 62 094 34 28
https://www.fryske-akademy.nl/
https://frysker.nl/
https://frisian.eu/
[cid:b16880ff-4d10-476b-8d0b-2082bf54e33f]
gpg: pgp.key-server.io/pks/lookup?search=eduarddrenth
_______________________________________________
Exist-open mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/exist-open
Outlook-enb00xb0.png
(image/png, 10.6 KB) - not displayed