validateAll.pl
- $ERROR_FILE = 'c:\q\errors.log';
- $ALL_ERROR_FILE = 'c:\q\allerrors.log';
- $VALIDATOR = "c:\\q\\sp1_3\\bin\\nsgmls.exe -wxml -s -f $ERROR_FILE ";
- use Cwd;
- use File::Path;
- use File::Basename;
- sub directory
- {
- my (@list, $item);
- opendir DIR,".";
- @list = readdir DIR;
- #remove . and ..
- shift(@list);
- shift(@list);
-
- foreach $item (@list)
- {
- if (-f $item) {file($item);}
- if (-d $item) {
- chdir($item);
- directory($item);
- chdir ("..");
- }
- }
- }
- sub file
- {
- print "#";
- if($_[0]=~/\.xml/) {
-
- if(-e "$ERROR_FILE") {system "del $ERROR_FILE";}
- system ("$VALIDATOR $_[0]");
-
- if (open IN, "$ERROR_FILE")
- {
- read IN, $tmp, 1000000;
- close IN;
- chomp($tmp);
-
- if ($tmp ne '')
- {
- print OUT "\n\n:::Directory: ";
- print OUT cwd();
- print OUT " File: $_[0]\n";
- $tmp=~ s/c\:\\q\\sp1_3\\bin\\nsgmls\.exe\://g;
- print OUT $tmp;
- }
- }
- }
- }
- if(-e "$ALL_ERROR_FILE") {system "del $ALL_ERROR_FILE";}
- open OUT, ">>$ALL_ERROR_FILE";
- directory();
- close OUT;
- system ("notepad $ALL_ERROR_FILE");