Skip Menu |

This queue is for tickets about the XML-SAX CPAN distribution.

Report information
The Basics
Id: 12727
Status: resolved
Priority: 0/
Queue: XML-SAX

People
Owner: Nobody in particular
Requestors: bsb [...] sanger.ac.uk
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.12
Fixed in: (no value)



Subject: changing handlers during parsing
I tried to write to split Handlers for a scheme into different files, one for each major element type. Whenever I tried to use set_handler or set_content_handler, the parser just continued using the initial handler. I used XML::SAX::Expat, which delegates this kind of business to XML::SAX::Base, right? So, after hours of investigation, I think the problem is a local parameter in XML::SAX::Base called $self->{ParseOptions}. This never changes after creation and can't be modified through methods, at least I couldn't figure out how. Adding the line $self->{ParseOptions}->{$handler_type} = $new_handler; to set_handler resolved the issue. You might think of incorporating this, or is it my ignorance and I don't see the obvious solution? Cheers, Benjamin
From: bsb [...] sanger.ac.uk
This little patch to XML-SAX-Base/Makefile.PL should do the trick!
*** XML-SAX-0.12/XML-SAX-Base/Makefile.PL Thu May 23 14:53:23 2002 --- XML-SAX-0.121/XML-SAX-Base/Makefile.PL Tue May 10 09:42:44 2005 *************** *** 33,38 **** --- 33,39 ---- # version 1.02 - Robin Berjon <robin@knowscape.com> # version 1.03 - Matt Sergeant <matt@sergeant.org> # version 1.04 - Kip Hampton <khampton@totalcinema.com> + # version 1.041 - Benjamin Schuster <bsb@sanger.ac.uk> #-----------------------------------------------------# # STOP!!!!! *************** *** 47,53 **** use vars qw($VERSION); use XML::SAX::Exception qw(); ! $VERSION = '1.04'; EOHEADER --- 48,54 ---- use vars qw($VERSION); use XML::SAX::Exception qw(); ! $VERSION = '1.041'; EOHEADER *************** *** 393,398 **** --- 394,400 ---- $handler_type ||= 'Handler'; $self->{Methods} = {} if $self->{Methods}; $self->{$handler_type} = $new_handler; + $self->{ParseOptions}->{$handler_type} = $new_handler; return 1; }