in reply to Re: XML::Twig too many children?
in thread XML::Twig too many children?
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.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: XML::Twig too many children?
by ikegami (Patriarch) on Feb 21, 2012 at 23:51 UTC | |
by tye (Sage) on Feb 22, 2012 at 01:00 UTC | |
by ikegami (Patriarch) on Feb 22, 2012 at 00:42 UTC | |
by ikegami (Patriarch) on Feb 22, 2012 at 01:00 UTC | |
|
Re^3: XML::Twig too many children?
by choroba (Cardinal) on Feb 21, 2012 at 21:26 UTC |