Sign In/My Account | View Cart  
advertisement

Article:
 Introducing XML::SAX::Machines, Part One
Subject: Minor bug in Widget::Include
Date: 2002-04-26 03:47:17
From: Grant McLean

The Widget::Include module uses a SAX parser to
parse the included file and send it as SAX events
to the downstream handlers. Unfortunately, this
event stream include start_document() and end_document() - downstream handlers probably only expect to see one of each.


I'd suggest setting a flag around the parse:


$self->{in_include} = 1;
$p->parse_uri( $uri ); # original line
$self->{in_include} = 0;


And implementing start/end_document handlers that
don't propagate the extra events, eg:


sub start_document {
my $self = shift;
$self->SUPER::start_document() unless($self->{in_include});
}



No Previous Message Previous Message   Next Message No Next Message


Sponsored By: