Subversion Repositories wimsdev

Rev

Rev 11930 | Blame | Compare with Previous | Last modification | View Log | RSS feed

  1. #!/usr/bin/perl
  2.  
  3.  
  4. ## validator file validator_uri
  5. my $file = shift(@ARGV);
  6. my $uri = shift(@ARGV);
  7. if ($uri =~ /http/) {
  8.   use WebService::Validator::HTML::W3C;
  9.    my $v = WebService::Validator::HTML::W3C->new(detailed => 1);
  10.     $v->validator_uri($uri);
  11. }
  12. {
  13.   use WebService::Validator::HTML::W3C::Fast;
  14.   my $v = WebService::Validator::HTML::W3C::Fast->new("detailed" => 1, validator_path  => '$uri');
  15. }
  16.  if ( $v->validate_file("$file") ) {
  17.    if ( !$v->is_valid )
  18.    {
  19.      foreach my $E (@{$v->errors}) {
  20.        ##next if ($E->msg =~ /not allowed in prolog/);
  21.        next if ($E->msg =~ /Conflict between Mime Type/); #error coming from last.html
  22.        next if ($E->msg =~ /xmlParseEntityRef/); #error I do not understand, link with &
  23.        printf("\$wims_name_Error: line %d, %s\n", $E->line, $E->msg);
  24.      }
  25.      foreach my $E (@{$v->warnings}) {
  26.        next if ($E->msg =~ /character "(&|&)" is the first character of a delimiter but occurred as data/);  ##due to wims
  27.        next if ($E->msg =~ /Conflict between Mime Type/);  #error coming from last.html
  28.        next if ($E->msg =~ /xmlParseEntityRef/); #error I do not understand, link with &
  29.        printf("\$wims_name_warning: line %d, %s\n", $E->line, $E->msg);}
  30.    }
  31.  } else {
  32.      printf ("Failed to validate the validator $v->uri : %s\n", $v->validator_error);
  33.  }
  34.