File: validator.pl

package info (click to toggle)
wims 2%3A4.29a%2Bdfsg1-3
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 185,704 kB
  • sloc: xml: 366,687; javascript: 120,570; ansic: 62,341; java: 62,170; sh: 7,744; perl: 3,937; yacc: 3,217; cpp: 1,915; lex: 1,805; makefile: 1,084; lisp: 914; pascal: 601; python: 520; php: 318; asm: 7
file content (33 lines) | stat: -rwxr-xr-x 1,519 bytes parent folder | download | duplicates (5)
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);
 }