W3C home > Mailing lists > Public > www-validator-cvs@w3.org > August 2008

validator/httpd/cgi-bin check,1.593,1.594

From: Olivier Thereaux via cvs-syncmail <cvsmail@w3.org>
Date: Fri, 15 Aug 2008 18:25:52 +0000
To: www-validator-cvs@w3.org
Message-Id: <E1KU3zk-0002pC-QD@lionel-hutz.w3.org>

Update of /sources/public/validator/httpd/cgi-bin
In directory hutz:/tmp/cvs-serv10597

Modified Files:
	check 
Log Message:
HTML5 checking bug fixes:
* handling case where XML from html5 checker can not be parsed
* errors -> marked as validation fail



Index: check
===================================================================
RCS file: /sources/public/validator/httpd/cgi-bin/check,v
retrieving revision 1.593
retrieving revision 1.594
diff -u -d -r1.593 -r1.594
--- check	15 Aug 2008 13:28:09 -0000	1.593
+++ check	15 Aug 2008 18:25:50 -0000	1.594
@@ -840,11 +840,6 @@
   $ua->env_proxy();
   $ua->agent($File->{Opt}->{'User Agent'});
   $ua->parse_head(0);  # Don't parse the http-equiv stuff.
-  eval { require HTTP::Request::Common;};
-  if ($@) {
-      warn "HTTP::Request::Common needs to be installed to check HTML5 content";
-      return $File;
-  }
   use HTTP::Request::Common;
   # telling caches in the middle we want a fresh copy (Bug 4998)
   $ua->default_header(Cache_control=> "max-age=0");
@@ -863,7 +858,14 @@
     # I wish we could use XML::LibXML::Reader here. but SHAME on those major
     # unix distributions still shipping with libxml2 2.6.16… 4 years after its release
     my $xml_reader = XML::LibXML->new();
-    my $xmlDOM = $xml_reader->parse_string( $content);
+    my $xmlDOM;
+    eval { $xmlDOM = $xml_reader->parse_string( $content);};
+    if ($@) {
+      $File->{'Error Flagged'} = TRUE;
+      $File->{Templates}->{Error}->param(fatal_no_checker  => TRUE);   
+      $File->{Templates}->{Error}->param(fatal_missing_checker  => "HTML5 Validator");   
+      return $File;
+    }     
     my @nodelist = $xmlDOM->getElementsByTagName("messages");
     my $messages_node = $nodelist[0];
     my @message_nodes =  $messages_node->childNodes;  
@@ -874,6 +876,7 @@
       my ($html5_error_line, $html5_error_col, $html5_error_msg);
       if  ($message_type eq "error") {
         $err->{type} = "E";
+        $File->{'Is Valid'} = FALSE;
       }
       elsif ($message_type eq "info") {
         $err->{type} = "I";
Received on Friday, 15 August 2008 18:26:29 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 15:17:33 UTC