Issue with dtd validation

Wednesday, 18 February 2015 · 5 messages
FB
France Baril18 Feb 2015 02:05 #
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&apos;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 at architextus.com
CG
Christian Grün18 Feb 2015 09:17 #
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
Quoted text · France Baril · 65 lines
On Wed, Feb 18, 2015 at 1:05 AM, France Baril <france.baril at 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&apos;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 at architextus.com
CG
Christian Grünin reply to France Baril, 18 Feb 2015, 19:4618 Feb 2015 18:51 #
And thanks to Marco Lettere for supporting the implementation of this function a while ago ;)
Quoted text · France Baril · 104 lines
On Wed, Feb 18, 2015 at 6:46 PM, France Baril <france.baril at 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 at 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 at 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&apos;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 at architextus.com > > > > > -- > France Baril > Architecte documentaire / Documentation architect > france.baril at architextus.com
ML
Marco Lettere18 Feb 2015 19:29 #
Hahahahah! It was my pleasure! M.
Quoted text · Christian Grün · 107 lines
On 18/02/2015 18:51, Christian Grün wrote: > 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 at 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 at 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 at 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&apos;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 at architextus.com >> >> >> >> -- >> France Baril >> Architecte documentaire / Documentation architect >> france.baril at architextus.com
FB
France Barilin reply to Christian Grün, 18 Feb 2015, 09:1718 Feb 2015 19:46 #
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!
Quoted text · Christian Grün · 86 lines
On Wed, Feb 18, 2015 at 3:17 AM, Christian Grün <christian.gruen at 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 at 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&apos;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 at architextus.com >
-- France Baril Architecte documentaire / Documentation architect france.baril at architextus.com

⚡Generated with XQuery