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/</&lt;/g; $line =~ s/>/&gt;/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 } } }

In reply to Re^2: Deep recursion error using LibXML by mertserger
in thread Deep recursion error using LibXML by mertserger

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.