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