4 # Examine output of 'xmllint --sax --html'
6 my $file = $ARGV[0]; # file to examine
8 my @tag = (); # tag entries = {"name" => strng, "count" => sequence number}
9 my $tagindex = 0; # next tag to be written
13 if (open(FI, $file)) {
15 my $saxchartoprint = 0;
19 if ($l =~ /^SAX.startElementNs\(([^, \)]+)/) {
23 #print "Start tag $tag at line $line, tagindex = $tagindex\n";
25 if (defined($tag[$tagindex]->{"name"})) {
26 if ($tag[$tagindex]->{"name"} eq $tag) {
27 $tag[$tagindex]->{"count"} = $tag[$tagindex]->{"count"}+1;
33 $tag[$tagindex]->{"name"} = $tag;
34 $tag[$tagindex]->{"count"} = 1;
39 elsif ($l =~ /^SAX.endElementNs\(([^, \)]+)/) {
43 #print "End tag $tag at line $line, tagindex = $tagindex\n";
47 if ($tag[$tagindex]->{"name"} ne $tag) {
48 die("End tag $tag does not match " . $tag[$tagindex]->{"name"} . " at line $line");
51 elsif ($l =~ /^SAX.error: (.*)$/) {
53 if ($err =~ /Entity\s+'([a-zA-Z0-9]+)'\s+not defined$/) {
54 # Ignore Entity 'xxxx' not defined
56 elsif (! defined($errors{$err})) {
59 for (my $i = 0; $i < $tagindex; $i++) {
60 $errmsg .= $trenner . $tag[$i]->{"name"} . "(" . $tag[$i]->{"count"} . ")";
63 $errors{$err} = $errmsg;
64 print "$err -> $errmsg\n";
65 # Print the next 3 lines starting with 'SAX.characters('
69 elsif ($saxchartoprint > 0) {
71 if ($l =~ /^SAX.characters\(([^\)]+)\)/) {