And thanks to Marco Lettere for supporting the implementation of this function a while ago ;)
On Wed, Feb 18, 2015 at 6:46 PM, France Baril france.baril@architextus.com wrote:
Ha! And it works like I expected validate-dtd to work in previous versions, no need to catch errors, get them as a list.
Big thanks!
On Wed, Feb 18, 2015 at 3:17 AM, Christian Grün christian.gruen@gmail.com wrote:
Hi France,
Did you alreaady try validate:dtd-info [1]?
Hope this helps, Christian
[1] http://docs.basex.org/wiki/Validation_Module#validate:dtd-info
On Wed, Feb 18, 2015 at 1:05 AM, France Baril france.baril@architextus.com wrote:
Hi,
Since my last upgrade to BaseX 8.0 beta 9cb3a37 (also just tried BaseX 8.0.1 beta 161c4fd), I noticed that the dtd validation errors are cut when to long, so I'm getting messages like this one, that don't help my users much:
File 'html-review/dh4/device-help/3338/50/global/en-us/T1401261601.html' doesn't validate against BaseX-DTDs/xhtml/xhtml1-transitional.dtd. Error [bxerr:BXVA0001]: Validation failed. "Error:archie, 5:28: Attribute "...
Plus, in previous versions, I was removing some errors that we don't care about, which I can't do anymore.
Is there a new option to get the full messages like I used to with $err:description?
Here is my code snippet (sorry for the ugly color coding in there... never had time to upgrade them to @class):
let $errors := <ul>{ for $file in $files return try{ let $validate := validate:dtd($file, $dtd-file-path) return <li style="color:green">Ye!</li> } catch * { let $error-description := $err:description return if (contains (normalize-space($error-description), normalize-space('Attribute ""xmlns"" must be declared for element type')) or contains (normalize-space($error-description), normalize-space('Attribute ""xmlns:xsi"" must be declared for element type'))) (: The 'xmlns' error is introduced by BaseX, and does not get exported to static content, so we ignore it :) then () else if (contains (normalize-space($error-description), normalize-space('Attribute ""content"" is required and must be specified for element type ""meta""'))) then () (: No longer true in HTML5 :) else <li style="color:red;"> <p>File '{$file/base-uri()}' doesn't validate against {$dtd-file-path}.</p> <p>{'Error [' || $err:code || ']: ' || $err:description}</p> </li> } }</ul>
(:let $debug := file:write('debug-in-fix-validation.xml', $errors):) return <ul>{$errors//li[contains(@style, 'color:red;')]}</ul>
-- France Baril Architecte documentaire / Documentation architect france.baril@architextus.com
-- France Baril Architecte documentaire / Documentation architect france.baril@architextus.com