in reply to How to force end_document in XML::SAX?
But maybe you can do something like this in your start_element():
if ($all_done) { $self->end_document(); die "Ended early!\n"; }
Then in your parsing code you can catch the exception with eval and handle it:
eval { # parse call here }; if ($@ and $@ =~ /Ended early/) { # it's ok } elsif ($@) { die $@; }
For a slightly prettier solution, create a new exception class based on XML::SAX::Exception and key on that class rather than the message in $@.
-sam
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How to force end_document in XML::SAX?
by mifflin (Curate) on Nov 10, 2004 at 21:15 UTC |