Hi France,
just a short one for today.. did you try to enclose your validate function with try/catch?
Christian
Hi,We are having challenges with validation.We have built a Documentation Controller for authors that create XML content. On a regular basis, we ask them to check that all documents are valid. We are running the process on hundreds of file. the ideal situation would be to collect all errors and display them of the webpage for authors to find and correct.Ex. of dream code:let $db := app:open-db($lang)
let $topic-validation := <ul>{for $x in $db/*[name()='topic' or name()='media']
return if (contains(validate:dtd($x, $app:dtd-topic), 'BXVA0001'))
then <li>File {$x/base-uri()} doesn't validate against the DTD.</li>
else ()
}
</ul>
let $menu-validation := <ul>{for $x in $db/*[name()='menu']
return if (contains(validate:dtd($x, $app:dtd-menu), 'BXVA0001'))
then <li>File {$x/base-uri()} doesn't validate against the DTD.</li>
else ()
}</ul>
return if (count($topic-validation/li) + count($menu-validation/li[normalize-space(.) != '']) != 0)
then <div>{$topic-validation}{$menu-validation}</div>
else <ul><li style="color:green">All menus and topics validate against the DTDs.</li></ul>Instead, as soon as validate:dtd finds one single file with an error, it crashes the web page with an error message like this:Stopped at line 270, column 77 in /Applications/basex75/webapp/restxq/How2_Admin.xqm: [BXVA0001] Validation failed: 1355790115420.xml, 3:22: Element type "headin" must be declared.On top of this, the name of the file that is referenced in the error message doesn't exist.I've been querying the DB to find errors. Ex. Search for all files with 'headin' in this case. However, we'd really like the writer to be able to find their own faulty files.Are we misusing the function? Is this a bug? What can we do about it?Thanks in advance for you help!
--
France Baril
Architecte documentaire / Documentation architect
france.baril@architextus.com
(514) 572-0341
_______________________________________________
BaseX-Talk mailing list
BaseX-Talk@mailman.uni-konstanz.de
https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk