Your example works fine for me too (except that it won't swallow the <<XML; ... XML construction, so I rewrote it).
However, it breaks if I have just one <lemma>-tag with many children. I find that the breaking point is at 4696/4697.
use warnings; use strict; use XML::Twig; my $children = 4697; my $found; my $xmlStr = '<XML><lemma>'.join("\n",@{['<line>1</line>' x $children] +}).'</lemma></XML>'; my $twig = XML::Twig->new( keep_encoding => 1, twig_handlers => {'lemma' => \&ProcessLemma} ); $twig->parse($xmlStr); print "Expected one, found $found\n"; sub ProcessLemma { my ($XmlTwig, $XmlLemma) = @_; ++$found; $XmlLemma->purge; return 1; }
Btw, I don't know if it matters, but I'm using Win32, ActivePerl 5.14.2.
In reply to Re^2: XML::Twig too many children?
by robbv
in thread XML::Twig too many children?
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |