I am not sure where to add that line to my code.
I have looked at the code again and I think the problem is in the subroutine which is trying to parse the entry against the DTD, rather than the code finding additional errors. The DTD checking sub routine is:
sub get_dtd_errors {
my $elt = shift;
use XML::LibXML;
my $parser = XML::LibXML->new();
$parser->validation(1); # switches DTD validation on
my $tag = $elt->tag;
my $element = &get_xml_prolog($tag) . $elt->sprint;
if ( $element =~ m/<Entry[^>]*? e:id="(.*?)"/ ) { $element_id = $1
+; }
# warn "Processing:\n\t$element";
### remove non-DTD tagging
$element =~ s/ (e:.*?|xmlns|xmlns:e|xml:space)=".*?"//g; # remove
+EE attributes
$element =~ s/ (refentry|refid|rel|style)=".*?"//g; # remove xref
+attributes
$element =~ s/ (lid)=".*?"//g; # remove 'lid' attributes
$element =~ s/<\/?e:TEXT[^>]*?>//g; # remove EE tags
$element =~ s/<\/?e:INTER[^>]*?>//g;
eval { my $doc = $parser->parse_string($element) };
if (my $err = $@) {
my @err = split /\n/, $err;
my $last = pop(@err);
my $modulo3 = 0;
my $skip = 0; # allows us to ignore certain messages
my $vfSectLoose = 0;
foreach my $line (@err) {
if ($line =~ m/vfSectLoose/ ) {$vfSectLoose = 1;}
}
foreach $line (@err) {
### Each error comes in three lines: the message, the text fragment co
+ntaining the error, and a pointer
### we format the different lines in slightly different ways
if ( $modulo3 == 0 ) {
# if ( $line =~ m/No declaration for attribute wotd of e
+lement Entry/ ) { $skip = 1; }
if ( !$skip ) {
$line =~ s/^\:\d+\: //;
$line = "<li>" . $line . "\n<p>\n";
$dtd_errors++;
}
}
if ( $modulo3 == 1 && !$skip) {
$line =~ s/</</g;
$line =~ s/>/>/g;
$line = "<pre>" . $line . "</pre>\n";
}
if ( $modulo3 == 2 && !$skip ) {
$line =~ s/ /-/g;
$line = "<pre>" . $line . "</pre></p></li>\n";
}
$dtd_error_page .= $line unless $skip;
$modulo3++;
if ( $modulo3 == 3 ) {
$modulo3 = 0 ;
$skip = 0; # reset skip
}
}
}