Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I've been having trouble with a script that terminates unexpectedly and silently. In the script I'm parsing an XML tree using XML::Twig, extracting information and purging as it parses, with the use of handlers (so it uses only a couple of MB of memory):
my $twig = XML::Twig->new(keep_encoding => 1, twig_handlers => {'lemma' => \&ProcessLemma}); sub ProcessLemma { my ($XmlTwig, $XmlLemma) = @_; # extract information here... $XmlLemma->purge; return 1; }
So far so good, but on a particular XML file, it would suddenly quit, without any error message. Now I've stripped the file that causes the problem down to the minimum that makes the script terminate. It contains a node with about 4800 children.
Is there a maximum number of children that Twig can handle? Is this why my script dies? (And is there a way to fix this?)
Thank you in advance for you help!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: XML::Twig too many children?
by GrandFather (Saint) on Feb 21, 2012 at 20:03 UTC | |
by robbv (Initiate) on Feb 21, 2012 at 20:33 UTC | |
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 | |
by choroba (Cardinal) on Feb 21, 2012 at 21:26 UTC | |
|
Re: XML::Twig too many children?
by mirod (Canon) on Feb 22, 2012 at 08:54 UTC | |
by Anonymous Monk on Jun 24, 2012 at 04:04 UTC | |
|
Re: XML::Twig too many children?
by ikegami (Patriarch) on Feb 21, 2012 at 23:37 UTC | |
by robbv (Initiate) on Feb 22, 2012 at 07:38 UTC |