<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">package XML::SAX::Base;
BEGIN {
  $XML::SAX::Base::VERSION = '1.07';
}

# version 0.10 - Kip Hampton &lt;khampton@totalcinema.com&gt;
# version 0.13 - Robin Berjon &lt;robin@knowscape.com&gt;
# version 0.15 - Kip Hampton &lt;khampton@totalcinema.com&gt;
# version 0.17 - Kip Hampton &lt;khampton@totalcinema.com&gt;
# version 0.19 - Kip Hampton &lt;khampton@totalcinema.com&gt;
# version 0.21 - Kip Hampton &lt;khampton@totalcinema.com&gt;
# version 0.22 - Robin Berjon &lt;robin@knowscape.com&gt;
# version 0.23 - Matt Sergeant &lt;matt@sergeant.org&gt;
# version 0.24 - Robin Berjon &lt;robin@knowscape.com&gt;
# version 0.25 - Kip Hampton &lt;khampton@totalcinema.com&gt;
# version 1.00 - Kip Hampton &lt;khampton@totalcinema.com&gt;
# version 1.01 - Kip Hampton &lt;khampton@totalcinema.com&gt;
# version 1.02 - Robin Berjon &lt;robin@knowscape.com&gt;
# version 1.03 - Matt Sergeant &lt;matt@sergeant.org&gt;
# version 1.04 - Kip Hampton &lt;khampton@totalcinema.com&gt;
# version 1.05 - Grant McLean &lt;grantm@cpan.org&gt;
# version 1.06 - Grant McLean &lt;grantm@cpan.org&gt;
# version 1.07 - Grant McLean &lt;grantm@cpan.org&gt;

#-----------------------------------------------------#
# STOP!!!!!
#
# This file is generated by the 'BuildSAXBase.PL' file
# that ships with the XML::SAX::Base distribution.
# If you need to make changes, patch that file NOT
# XML/SAX/Base.pm  Better yet, fork the git repository
# commit your changes and send a pull request:
#   https://github.com/grantm/XML-SAX-Base
#-----------------------------------------------------#

use strict;

use XML::SAX::Exception qw();

sub end_prefix_mapping {
    my $self = shift;
    if (defined $self-&gt;{Methods}-&gt;{'end_prefix_mapping'}) {
        $self-&gt;{Methods}-&gt;{'end_prefix_mapping'}-&gt;(@_);
    }
    else {
        my $method;
        my $callbacks;
        if (exists $self-&gt;{ParseOptions}) {
            $callbacks = $self-&gt;{ParseOptions};
        }
        else {
            $callbacks = $self;
        }
        if (0) { # dummy to make elsif's below compile
        }
        elsif (defined $callbacks-&gt;{'ContentHandler'} and $method = $callbacks-&gt;{'ContentHandler'}-&gt;can('end_prefix_mapping') ) {
            my $handler = $callbacks-&gt;{'ContentHandler'};
            $self-&gt;{Methods}-&gt;{'end_prefix_mapping'} = sub { $method-&gt;($handler, @_) };
            return $method-&gt;($handler, @_);
        }
        elsif (defined $callbacks-&gt;{'Handler'} and $method = $callbacks-&gt;{'Handler'}-&gt;can('end_prefix_mapping') ) {
            my $handler = $callbacks-&gt;{'Handler'};
            $self-&gt;{Methods}-&gt;{'end_prefix_mapping'} = sub { $method-&gt;($handler, @_) };
            return $method-&gt;($handler, @_);
        }
        elsif (defined $callbacks-&gt;{'ContentHandler'} 
        	and $callbacks-&gt;{'ContentHandler'}-&gt;can('AUTOLOAD')
        	and $callbacks-&gt;{'ContentHandler'}-&gt;can('AUTOLOAD') ne (UNIVERSAL-&gt;can('AUTOLOAD') || '')
        	)
        {
            my $res = eval { $callbacks-&gt;{'ContentHandler'}-&gt;end_prefix_mapping(@_) };
            if ($@) {
                die $@;
            }
            else {
                # I think there's a buggette here...
                # if the first call throws an exception, we don't set it up right.
                # Not fatal, but we might want to address it.
                my $handler = $callbacks-&gt;{'ContentHandler'};
                $self-&gt;{Methods}-&gt;{'end_prefix_mapping'} = sub { $handler-&gt;end_prefix_mapping(@_) };
            }
            return $res;
        }
        elsif (defined $callbacks-&gt;{'Handler'} 
        	and $callbacks-&gt;{'Handler'}-&gt;can('AUTOLOAD')
        	and $callbacks-&gt;{'Handler'}-&gt;can('AUTOLOAD') ne (UNIVERSAL-&gt;can('AUTOLOAD') || '')
        	)
        {
            my $res = eval { $callbacks-&gt;{'Handler'}-&gt;end_prefix_mapping(@_) };
            if ($@) {
                die $@;
            }
            else {
                # I think there's a buggette here...
                # if the first call throws an exception, we don't set it up right.
                # Not fatal, but we might want to address it.
                my $handler = $callbacks-&gt;{'Handler'};
                $self-&gt;{Methods}-&gt;{'end_prefix_mapping'} = sub { $handler-&gt;end_prefix_mapping(@_) };
            }
            return $res;
        }
        else {
            $self-&gt;{Methods}-&gt;{'end_prefix_mapping'} = sub { };
        }
    }

}

sub internal_entity_decl {
    my $self = shift;
    if (defined $self-&gt;{Methods}-&gt;{'internal_entity_decl'}) {
        $self-&gt;{Methods}-&gt;{'internal_entity_decl'}-&gt;(@_);
    }
    else {
        my $method;
        my $callbacks;
        if (exists $self-&gt;{ParseOptions}) {
            $callbacks = $self-&gt;{ParseOptions};
        }
        else {
            $callbacks = $self;
        }
        if (0) { # dummy to make elsif's below compile
        }
        elsif (defined $callbacks-&gt;{'DeclHandler'} and $method = $callbacks-&gt;{'DeclHandler'}-&gt;can('internal_entity_decl') ) {
            my $handler = $callbacks-&gt;{'DeclHandler'};
            $self-&gt;{Methods}-&gt;{'internal_entity_decl'} = sub { $method-&gt;($handler, @_) };
            return $method-&gt;($handler, @_);
        }
        elsif (defined $callbacks-&gt;{'Handler'} and $method = $callbacks-&gt;{'Handler'}-&gt;can('internal_entity_decl') ) {
            my $handler = $callbacks-&gt;{'Handler'};
            $self-&gt;{Methods}-&gt;{'internal_entity_decl'} = sub { $method-&gt;($handler, @_) };
            return $method-&gt;($handler, @_);
        }
        elsif (defined $callbacks-&gt;{'DeclHandler'} 
        	and $callbacks-&gt;{'DeclHandler'}-&gt;can('AUTOLOAD')
        	and $callbacks-&gt;{'DeclHandler'}-&gt;can('AUTOLOAD') ne (UNIVERSAL-&gt;can('AUTOLOAD') || '')
        	)
        {
            my $res = eval { $callbacks-&gt;{'DeclHandler'}-&gt;internal_entity_decl(@_) };
            if ($@) {
                die $@;
            }
            else {
                # I think there's a buggette here...
                # if the first call throws an exception, we don't set it up right.
                # Not fatal, but we might want to address it.
                my $handler = $callbacks-&gt;{'DeclHandler'};
                $self-&gt;{Methods}-&gt;{'internal_entity_decl'} = sub { $handler-&gt;internal_entity_decl(@_) };
            }
            return $res;
        }
        elsif (defined $callbacks-&gt;{'Handler'} 
        	and $callbacks-&gt;{'Handler'}-&gt;can('AUTOLOAD')
        	and $callbacks-&gt;{'Handler'}-&gt;can('AUTOLOAD') ne (UNIVERSAL-&gt;can('AUTOLOAD') || '')
        	)
        {
            my $res = eval { $callbacks-&gt;{'Handler'}-&gt;internal_entity_decl(@_) };
            if ($@) {
                die $@;
            }
            else {
                # I think there's a buggette here...
                # if the first call throws an exception, we don't set it up right.
                # Not fatal, but we might want to address it.
                my $handler = $callbacks-&gt;{'Handler'};
                $self-&gt;{Methods}-&gt;{'internal_entity_decl'} = sub { $handler-&gt;internal_entity_decl(@_) };
            }
            return $res;
        }
        else {
            $self-&gt;{Methods}-&gt;{'internal_entity_decl'} = sub { };
        }
    }

}

sub characters {
    my $self = shift;
    if (defined $self-&gt;{Methods}-&gt;{'characters'}) {
        $self-&gt;{Methods}-&gt;{'characters'}-&gt;(@_);
    }
    else {
        my $method;
        my $callbacks;
        if (exists $self-&gt;{ParseOptions}) {
            $callbacks = $self-&gt;{ParseOptions};
        }
        else {
            $callbacks = $self;
        }
        if (0) { # dummy to make elsif's below compile
        }
        elsif (defined $callbacks-&gt;{'ContentHandler'} and $method = $callbacks-&gt;{'ContentHandler'}-&gt;can('characters') ) {
            my $handler = $callbacks-&gt;{'ContentHandler'};
            $self-&gt;{Methods}-&gt;{'characters'} = sub { $method-&gt;($handler, @_) };
            return $method-&gt;($handler, @_);
        }
        elsif (defined $callbacks-&gt;{'DocumentHandler'} and $method = $callbacks-&gt;{'DocumentHandler'}-&gt;can('characters') ) {
            my $handler = $callbacks-&gt;{'DocumentHandler'};
            $self-&gt;{Methods}-&gt;{'characters'} = sub { $method-&gt;($handler, @_) };
            return $method-&gt;($handler, @_);
        }
        elsif (defined $callbacks-&gt;{'Handler'} and $method = $callbacks-&gt;{'Handler'}-&gt;can('characters') ) {
            my $handler = $callbacks-&gt;{'Handler'};
            $self-&gt;{Methods}-&gt;{'characters'} = sub { $method-&gt;($handler, @_) };
            return $method-&gt;($handler, @_);
        }
        elsif (defined $callbacks-&gt;{'ContentHandler'} 
        	and $callbacks-&gt;{'ContentHandler'}-&gt;can('AUTOLOAD')
        	and $callbacks-&gt;{'ContentHandler'}-&gt;can('AUTOLOAD') ne (UNIVERSAL-&gt;can('AUTOLOAD') || '')
        	)
        {
            my $res = eval { $callbacks-&gt;{'ContentHandler'}-&gt;characters(@_) };
            if ($@) {
                die $@;
            }
            else {
                # I think there's a buggette here...
                # if the first call throws an exception, we don't set it up right.
                # Not fatal, but we might want to address it.
                my $handler = $callbacks-&gt;{'ContentHandler'};
                $self-&gt;{Methods}-&gt;{'characters'} = sub { $handler-&gt;characters(@_) };
            }
            return $res;
        }
        elsif (defined $callbacks-&gt;{'DocumentHandler'} 
        	and $callbacks-&gt;{'DocumentHandler'}-&gt;can('AUTOLOAD')
        	and $callbacks-&gt;{'DocumentHandler'}-&gt;can('AUTOLOAD') ne (UNIVERSAL-&gt;can('AUTOLOAD') || '')
        	)
        {
            my $res = eval { $callbacks-&gt;{'DocumentHandler'}-&gt;characters(@_) };
            if ($@) {
                die $@;
            }
            else {
                # I think there's a buggette here...
                # if the first call throws an exception, we don't set it up right.
                # Not fatal, but we might want to address it.
                my $handler = $callbacks-&gt;{'DocumentHandler'};
                $self-&gt;{Methods}-&gt;{'characters'} = sub { $handler-&gt;characters(@_) };
            }
            return $res;
        }
        elsif (defined $callbacks-&gt;{'Handler'} 
        	and $callbacks-&gt;{'Handler'}-&gt;can('AUTOLOAD')
        	and $callbacks-&gt;{'Handler'}-&gt;can('AUTOLOAD') ne (UNIVERSAL-&gt;can('AUTOLOAD') || '')
        	)
        {
            my $res = eval { $callbacks-&gt;{'Handler'}-&gt;characters(@_) };
            if ($@) {
                die $@;
            }
            else {
                # I think there's a buggette here...
                # if the first call throws an exception, we don't set it up right.
                # Not fatal, but we might want to address it.
                my $handler = $callbacks-&gt;{'Handler'};
                $self-&gt;{Methods}-&gt;{'characters'} = sub { $handler-&gt;characters(@_) };
            }
            return $res;
        }
        else {
            $self-&gt;{Methods}-&gt;{'characters'} = sub { };
        }
    }

}

sub start_element {
    my $self = shift;
    if (defined $self-&gt;{Methods}-&gt;{'start_element'}) {
        $self-&gt;{Methods}-&gt;{'start_element'}-&gt;(@_);
    }
    else {
        my $method;
        my $callbacks;
        if (exists $self-&gt;{ParseOptions}) {
            $callbacks = $self-&gt;{ParseOptions};
        }
        else {
            $callbacks = $self;
        }
        if (0) { # dummy to make elsif's below compile
        }
        elsif (defined $callbacks-&gt;{'ContentHandler'} and $method = $callbacks-&gt;{'ContentHandler'}-&gt;can('start_element') ) {
            my $handler = $callbacks-&gt;{'ContentHandler'};
            $self-&gt;{Methods}-&gt;{'start_element'} = sub { $method-&gt;($handler, @_) };
            return $method-&gt;($handler, @_);
        }
        elsif (defined $callbacks-&gt;{'DocumentHandler'} and $method = $callbacks-&gt;{'DocumentHandler'}-&gt;can('start_element') ) {
            my $handler = $callbacks-&gt;{'DocumentHandler'};
            $self-&gt;{Methods}-&gt;{'start_element'} = sub { $method-&gt;($handler, @_) };
            return $method-&gt;($handler, @_);
        }
        elsif (defined $callbacks-&gt;{'Handler'} and $method = $callbacks-&gt;{'Handler'}-&gt;can('start_element') ) {
            my $handler = $callbacks-&gt;{'Handler'};
            $self-&gt;{Methods}-&gt;{'start_element'} = sub { $method-&gt;($handler, @_) };
            return $method-&gt;($handler, @_);
        }
        elsif (defined $callbacks-&gt;{'ContentHandler'} 
        	and $callbacks-&gt;{'ContentHandler'}-&gt;can('AUTOLOAD')
        	and $callbacks-&gt;{'ContentHandler'}-&gt;can('AUTOLOAD') ne (UNIVERSAL-&gt;can('AUTOLOAD') || '')
        	)
        {
            my $res = eval { $callbacks-&gt;{'ContentHandler'}-&gt;start_element(@_) };
            if ($@) {
                die $@;
            }
            else {
                # I think there's a buggette here...
                # if the first call throws an exception, we don't set it up right.
                # Not fatal, but we might want to address it.
                my $handler = $callbacks-&gt;{'ContentHandler'};
                $self-&gt;{Methods}-&gt;{'start_element'} = sub { $handler-&gt;start_element(@_) };
            }
            return $res;
        }
        elsif (defined $callbacks-&gt;{'DocumentHandler'} 
        	and $callbacks-&gt;{'DocumentHandler'}-&gt;can('AUTOLOAD')
        	and $callbacks-&gt;{'DocumentHandler'}-&gt;can('AUTOLOAD') ne (UNIVERSAL-&gt;can('AUTOLOAD') || '')
        	)
        {
            my $res = eval { $callbacks-&gt;{'DocumentHandler'}-&gt;start_element(@_) };
            if ($@) {
                die $@;
            }
            else {
                # I think there's a buggette here...
                # if the first call throws an exception, we don't set it up right.
                # Not fatal, but we might want to address it.
                my $handler = $callbacks-&gt;{'DocumentHandler'};
                $self-&gt;{Methods}-&gt;{'start_element'} = sub { $handler-&gt;start_element(@_) };
            }
            return $res;
        }
        elsif (defined $callbacks-&gt;{'Handler'} 
        	and $callbacks-&gt;{'Handler'}-&gt;can('AUTOLOAD')
        	and $callbacks-&gt;{'Handler'}-&gt;can('AUTOLOAD') ne (UNIVERSAL-&gt;can('AUTOLOAD') || '')
        	)
        {
            my $res = eval { $callbacks-&gt;{'Handler'}-&gt;start_element(@_) };
            if ($@) {
                die $@;
            }
            else {
                # I think there's a buggette here...
                # if the first call throws an exception, we don't set it up right.
                # Not fatal, but we might want to address it.
                my $handler = $callbacks-&gt;{'Handler'};
                $self-&gt;{Methods}-&gt;{'start_element'} = sub { $handler-&gt;start_element(@_) };
            }
            return $res;
        }
        else {
            $self-&gt;{Methods}-&gt;{'start_element'} = sub { };
        }
    }

}

sub external_entity_decl {
    my $self = shift;
    if (defined $self-&gt;{Methods}-&gt;{'external_entity_decl'}) {
        $self-&gt;{Methods}-&gt;{'external_entity_decl'}-&gt;(@_);
    }
    else {
        my $method;
        my $callbacks;
        if (exists $self-&gt;{ParseOptions}) {
            $callbacks = $self-&gt;{ParseOptions};
        }
        else {
            $callbacks = $self;
        }
        if (0) { # dummy to make elsif's below compile
        }
        elsif (defined $callbacks-&gt;{'DeclHandler'} and $method = $callbacks-&gt;{'DeclHandler'}-&gt;can('external_entity_decl') ) {
            my $handler = $callbacks-&gt;{'DeclHandler'};
            $self-&gt;{Methods}-&gt;{'external_entity_decl'} = sub { $method-&gt;($handler, @_) };
            return $method-&gt;($handler, @_);
        }
        elsif (defined $callbacks-&gt;{'Handler'} and $method = $callbacks-&gt;{'Handler'}-&gt;can('external_entity_decl') ) {
            my $handler = $callbacks-&gt;{'Handler'};
            $self-&gt;{Methods}-&gt;{'external_entity_decl'} = sub { $method-&gt;($handler, @_) };
            return $method-&gt;($handler, @_);
        }
        elsif (defined $callbacks-&gt;{'DeclHandler'} 
        	and $callbacks-&gt;{'DeclHandler'}-&gt;can('AUTOLOAD')
        	and $callbacks-&gt;{'DeclHandler'}-&gt;can('AUTOLOAD') ne (UNIVERSAL-&gt;can('AUTOLOAD') || '')
        	)
        {
            my $res = eval { $callbacks-&gt;{'DeclHandler'}-&gt;external_entity_decl(@_) };
            if ($@) {
                die $@;
            }
            else {
                # I think there's a buggette here...
                # if the first call throws an exception, we don't set it up right.
                # Not fatal, but we might want to address it.
                my $handler = $callbacks-&gt;{'DeclHandler'};
                $self-&gt;{Methods}-&gt;{'external_entity_decl'} = sub { $handler-&gt;external_entity_decl(@_) };
            }
            return $res;
        }
        elsif (defined $callbacks-&gt;{'Handler'} 
        	and $callbacks-&gt;{'Handler'}-&gt;can('AUTOLOAD')
        	and $callbacks-&gt;{'Handler'}-&gt;can('AUTOLOAD') ne (UNIVERSAL-&gt;can('AUTOLOAD') || '')
        	)
        {
            my $res = eval { $callbacks-&gt;{'Handler'}-&gt;external_entity_decl(@_) };
            if ($@) {
                die $@;
            }
            else {
                # I think there's a buggette here...
                # if the first call throws an exception, we don't set it up right.
                # Not fatal, but we might want to address it.
                my $handler = $callbacks-&gt;{'Handler'};
                $self-&gt;{Methods}-&gt;{'external_entity_decl'} = sub { $handler-&gt;external_entity_decl(@_) };
            }
            return $res;
        }
        else {
            $self-&gt;{Methods}-&gt;{'external_entity_decl'} = sub { };
        }
    }

}

sub xml_decl {
    my $self = shift;
    if (defined $self-&gt;{Methods}-&gt;{'xml_decl'}) {
        $self-&gt;{Methods}-&gt;{'xml_decl'}-&gt;(@_);
    }
    else {
        my $method;
        my $callbacks;
        if (exists $self-&gt;{ParseOptions}) {
            $callbacks = $self-&gt;{ParseOptions};
        }
        else {
            $callbacks = $self;
        }
        if (0) { # dummy to make elsif's below compile
        }
        elsif (defined $callbacks-&gt;{'DTDHandler'} and $method = $callbacks-&gt;{'DTDHandler'}-&gt;can('xml_decl') ) {
            my $handler = $callbacks-&gt;{'DTDHandler'};
            $self-&gt;{Methods}-&gt;{'xml_decl'} = sub { $method-&gt;($handler, @_) };
            return $method-&gt;($handler, @_);
        }
        elsif (defined $callbacks-&gt;{'Handler'} and $method = $callbacks-&gt;{'Handler'}-&gt;can('xml_decl') ) {
            my $handler = $callbacks-&gt;{'Handler'};
            $self-&gt;{Methods}-&gt;{'xml_decl'} = sub { $method-&gt;($handler, @_) };
            return $method-&gt;($handler, @_);
        }
        elsif (defined $callbacks-&gt;{'DTDHandler'} 
        	and $callbacks-&gt;{'DTDHandler'}-&gt;can('AUTOLOAD')
        	and $callbacks-&gt;{'DTDHandler'}-&gt;can('AUTOLOAD') ne (UNIVERSAL-&gt;can('AUTOLOAD') || '')
        	)
        {
            my $res = eval { $callbacks-&gt;{'DTDHandler'}-&gt;xml_decl(@_) };
            if ($@) {
                die $@;
            }
            else {
                # I think there's a buggette here...
                # if the first call throws an exception, we don't set it up right.
                # Not fatal, but we might want to address it.
                my $handler = $callbacks-&gt;{'DTDHandler'};
                $self-&gt;{Methods}-&gt;{'xml_decl'} = sub { $handler-&gt;xml_decl(@_) };
            }
            return $res;
        }
        elsif (defined $callbacks-&gt;{'Handler'} 
        	and $callbacks-&gt;{'Handler'}-&gt;can('AUTOLOAD')
        	and $callbacks-&gt;{'Handler'}-&gt;can('AUTOLOAD') ne (UNIVERSAL-&gt;can('AUTOLOAD') || '')
        	)
        {
            my $res = eval { $callbacks-&gt;{'Handler'}-&gt;xml_decl(@_) };
            if ($@) {
                die $@;
            }
            else {
                # I think there's a buggette here...
                # if the first call throws an exception, we don't set it up right.
                # Not fatal, but we might want to address it.
                my $handler = $callbacks-&gt;{'Handler'};
                $self-&gt;{Methods}-&gt;{'xml_decl'} = sub { $handler-&gt;xml_decl(@_) };
            }
            return $res;
        }
        else {
            $self-&gt;{Methods}-&gt;{'xml_decl'} = sub { };
        }
    }

}

sub entity_decl {
    my $self = shift;
    if (defined $self-&gt;{Methods}-&gt;{'entity_decl'}) {
        $self-&gt;{Methods}-&gt;{'entity_decl'}-&gt;(@_);
    }
    else {
        my $method;
        my $callbacks;
        if (exists $self-&gt;{ParseOptions}) {
            $callbacks = $self-&gt;{ParseOptions};
        }
        else {
            $callbacks = $self;
        }
        if (0) { # dummy to make elsif's below compile
        }
        elsif (defined $callbacks-&gt;{'DTDHandler'} and $method = $callbacks-&gt;{'DTDHandler'}-&gt;can('entity_decl') ) {
            my $handler = $callbacks-&gt;{'DTDHandler'};
            $self-&gt;{Methods}-&gt;{'entity_decl'} = sub { $method-&gt;($handler, @_) };
            return $method-&gt;($handler, @_);
        }
        elsif (defined $callbacks-&gt;{'Handler'} and $method = $callbacks-&gt;{'Handler'}-&gt;can('entity_decl') ) {
            my $handler = $callbacks-&gt;{'Handler'};
            $self-&gt;{Methods}-&gt;{'entity_decl'} = sub { $method-&gt;($handler, @_) };
            return $method-&gt;($handler, @_);
        }
        elsif (defined $callbacks-&gt;{'DTDHandler'} 
        	and $callbacks-&gt;{'DTDHandler'}-&gt;can('AUTOLOAD')
        	and $callbacks-&gt;{'DTDHandler'}-&gt;can('AUTOLOAD') ne (UNIVERSAL-&gt;can('AUTOLOAD') || '')
        	)
        {
            my $res = eval { $callbacks-&gt;{'DTDHandler'}-&gt;entity_decl(@_) };
            if ($@) {
                die $@;
            }
            else {
                # I think there's a buggette here...
                # if the first call throws an exception, we don't set it up right.
                # Not fatal, but we might want to address it.
                my $handler = $callbacks-&gt;{'DTDHandler'};
                $self-&gt;{Methods}-&gt;{'entity_decl'} = sub { $handler-&gt;entity_decl(@_) };
            }
            return $res;
        }
        elsif (defined $callbacks-&gt;{'Handler'} 
        	and $callbacks-&gt;{'Handler'}-&gt;can('AUTOLOAD')
        	and $callbacks-&gt;{'Handler'}-&gt;can('AUTOLOAD') ne (UNIVERSAL-&gt;can('AUTOLOAD') || '')
        	)
        {
            my $res = eval { $callbacks-&gt;{'Handler'}-&gt;entity_decl(@_) };
            if ($@) {
                die $@;
            }
            else {
                # I think there's a buggette here...
                # if the first call throws an exception, we don't set it up right.
                # Not fatal, but we might want to address it.
                my $handler = $callbacks-&gt;{'Handler'};
                $self-&gt;{Methods}-&gt;{'entity_decl'} = sub { $handler-&gt;entity_decl(@_) };
            }
            return $res;
        }
        else {
            $self-&gt;{Methods}-&gt;{'entity_decl'} = sub { };
        }
    }

}

sub end_dtd {
    my $self = shift;
    if (defined $self-&gt;{Methods}-&gt;{'end_dtd'}) {
        $self-&gt;{Methods}-&gt;{'end_dtd'}-&gt;(@_);
    }
    else {
        my $method;
        my $callbacks;
        if (exists $self-&gt;{ParseOptions}) {
            $callbacks = $self-&gt;{ParseOptions};
        }
        else {
            $callbacks = $self;
        }
        if (0) { # dummy to make elsif's below compile
        }
        elsif (defined $callbacks-&gt;{'LexicalHandler'} and $method = $callbacks-&gt;{'LexicalHandler'}-&gt;can('end_dtd') ) {
            my $handler = $callbacks-&gt;{'LexicalHandler'};
            $self-&gt;{Methods}-&gt;{'end_dtd'} = sub { $method-&gt;($handler, @_) };
            return $method-&gt;($handler, @_);
        }
        elsif (defined $callbacks-&gt;{'Handler'} and $method = $callbacks-&gt;{'Handler'}-&gt;can('end_dtd') ) {
            my $handler = $callbacks-&gt;{'Handler'};
            $self-&gt;{Methods}-&gt;{'end_dtd'} = sub { $method-&gt;($handler, @_) };
            return $method-&gt;($handler, @_);
        }
        elsif (defined $callbacks-&gt;{'LexicalHandler'} 
        	and $callbacks-&gt;{'LexicalHandler'}-&gt;can('AUTOLOAD')
        	and $callbacks-&gt;{'LexicalHandler'}-&gt;can('AUTOLOAD') ne (UNIVERSAL-&gt;can('AUTOLOAD') || '')
        	)
        {
            my $res = eval { $callbacks-&gt;{'LexicalHandler'}-&gt;end_dtd(@_) };
            if ($@) {
                die $@;
            }
            else {
                # I think there's a buggette here...
                # if the first call throws an exception, we don't set it up right.
                # Not fatal, but we might want to address it.
                my $handler = $callbacks-&gt;{'LexicalHandler'};
                $self-&gt;{Methods}-&gt;{'end_dtd'} = sub { $handler-&gt;end_dtd(@_) };
            }
            return $res;
        }
        elsif (defined $callbacks-&gt;{'Handler'} 
        	and $callbacks-&gt;{'Handler'}-&gt;can('AUTOLOAD')
        	and $callbacks-&gt;{'Handler'}-&gt;can('AUTOLOAD') ne (UNIVERSAL-&gt;can('AUTOLOAD') || '')
        	)
        {
            my $res = eval { $callbacks-&gt;{'Handler'}-&gt;end_dtd(@_) };
            if ($@) {
                die $@;
            }
            else {
                # I think there's a buggette here...
                # if the first call throws an exception, we don't set it up right.
                # Not fatal, but we might want to address it.
                my $handler = $callbacks-&gt;{'Handler'};
                $self-&gt;{Methods}-&gt;{'end_dtd'} = sub { $handler-&gt;end_dtd(@_) };
            }
            return $res;
        }
        else {
            $self-&gt;{Methods}-&gt;{'end_dtd'} = sub { };
        }
    }

}

sub unparsed_entity_decl {
    my $self = shift;
    if (defined $self-&gt;{Methods}-&gt;{'unparsed_entity_decl'}) {
        $self-&gt;{Methods}-&gt;{'unparsed_entity_decl'}-&gt;(@_);
    }
    else {
        my $method;
        my $callbacks;
        if (exists $self-&gt;{ParseOptions}) {
            $callbacks = $self-&gt;{ParseOptions};
        }
        else {
            $callbacks = $self;
        }
        if (0) { # dummy to make elsif's below compile
        }
        elsif (defined $callbacks-&gt;{'DTDHandler'} and $method = $callbacks-&gt;{'DTDHandler'}-&gt;can('unparsed_entity_decl') ) {
            my $handler = $callbacks-&gt;{'DTDHandler'};
            $self-&gt;{Methods}-&gt;{'unparsed_entity_decl'} = sub { $method-&gt;($handler, @_) };
            return $method-&gt;($handler, @_);
        }
        elsif (defined $callbacks-&gt;{'Handler'} and $method = $callbacks-&gt;{'Handler'}-&gt;can('unparsed_entity_decl') ) {
            my $handler = $callbacks-&gt;{'Handler'};
            $self-&gt;{Methods}-&gt;{'unparsed_entity_decl'} = sub { $method-&gt;($handler, @_) };
            return $method-&gt;($handler, @_);
        }
        elsif (defined $callbacks-&gt;{'DTDHandler'} 
        	and $callbacks-&gt;{'DTDHandler'}-&gt;can('AUTOLOAD')
        	and $callbacks-&gt;{'DTDHandler'}-&gt;can('AUTOLOAD') ne (UNIVERSAL-&gt;can('AUTOLOAD') || '')
        	)
        {
            my $res = eval { $callbacks-&gt;{'DTDHandler'}-&gt;unparsed_entity_decl(@_) };
            if ($@) {
                die $@;
            }
            else {
                # I think there's a buggette here...
                # if the first call throws an exception, we don't set it up right.
                # Not fatal, but we might want to address it.
                my $handler = $callbacks-&gt;{'DTDHandler'};
                $self-&gt;{Methods}-&gt;{'unparsed_entity_decl'} = sub { $handler-&gt;unparsed_entity_decl(@_) };
            }
            return $res;
        }
        elsif (defined $callbacks-&gt;{'Handler'} 
        	and $callbacks-&gt;{'Handler'}-&gt;can('AUTOLOAD')
        	and $callbacks-&gt;{'Handler'}-&gt;can('AUTOLOAD') ne (UNIVERSAL-&gt;can('AUTOLOAD') || '')
        	)
        {
            my $res = eval { $callbacks-&gt;{'Handler'}-&gt;unparsed_entity_decl(@_) };
            if ($@) {
                die $@;
            }
            else {
                # I think there's a buggette here...
                # if the first call throws an exception, we don't set it up right.
                # Not fatal, but we might want to address it.
                my $handler = $callbacks-&gt;{'Handler'};
                $self-&gt;{Methods}-&gt;{'unparsed_entity_decl'} = sub { $handler-&gt;unparsed_entity_decl(@_) };
            }
            return $res;
        }
        else {
            $self-&gt;{Methods}-&gt;{'unparsed_entity_decl'} = sub { };
        }
    }

}

sub processing_instruction {
    my $self = shift;
    if (defined $self-&gt;{Methods}-&gt;{'processing_instruction'}) {
        $self-&gt;{Methods}-&gt;{'processing_instruction'}-&gt;(@_);
    }
    else {
        my $method;
        my $callbacks;
        if (exists $self-&gt;{ParseOptions}) {
            $callbacks = $self-&gt;{ParseOptions};
        }
        else {
            $callbacks = $self;
        }
        if (0) { # dummy to make elsif's below compile
        }
        elsif (defined $callbacks-&gt;{'ContentHandler'} and $method = $callbacks-&gt;{'ContentHandler'}-&gt;can('processing_instruction') ) {
            my $handler = $callbacks-&gt;{'ContentHandler'};
            $self-&gt;{Methods}-&gt;{'processing_instruction'} = sub { $method-&gt;($handler, @_) };
            return $method-&gt;($handler, @_);
        }
        elsif (defined $callbacks-&gt;{'DocumentHandler'} and $method = $callbacks-&gt;{'DocumentHandler'}-&gt;can('processing_instruction') ) {
            my $handler = $callbacks-&gt;{'DocumentHandler'};
            $self-&gt;{Methods}-&gt;{'processing_instruction'} = sub { $method-&gt;($handler, @_) };
            return $method-&gt;($handler, @_);
        }
        elsif (defined $callbacks-&gt;{'Handler'} and $method = $callbacks-&gt;{'Handler'}-&gt;can('processing_instruction') ) {
            my $handler = $callbacks-&gt;{'Handler'};
            $self-&gt;{Methods}-&gt;{'processing_instruction'} = sub { $method-&gt;($handler, @_) };
            return $method-&gt;($handler, @_);
        }
        elsif (defined $callbacks-&gt;{'ContentHandler'} 
        	and $callbacks-&gt;{'ContentHandler'}-&gt;can('AUTOLOAD')
        	and $callbacks-&gt;{'ContentHandler'}-&gt;can('AUTOLOAD') ne (UNIVERSAL-&gt;can('AUTOLOAD') || '')
        	)
        {
            my $res = eval { $callbacks-&gt;{'ContentHandler'}-&gt;processing_instruction(@_) };
            if ($@) {
                die $@;
            }
            else {
                # I think there's a buggette here...
                # if the first call throws an exception, we don't set it up right.
                # Not fatal, but we might want to address it.
                my $handler = $callbacks-&gt;{'ContentHandler'};
                $self-&gt;{Methods}-&gt;{'processing_instruction'} = sub { $handler-&gt;processing_instruction(@_) };
            }
            return $res;
        }
        elsif (defined $callbacks-&gt;{'DocumentHandler'} 
        	and $callbacks-&gt;{'DocumentHandler'}-&gt;can('AUTOLOAD')
        	and $callbacks-&gt;{'DocumentHandler'}-&gt;can('AUTOLOAD') ne (UNIVERSAL-&gt;can('AUTOLOAD') || '')
        	)
        {
            my $res = eval { $callbacks-&gt;{'DocumentHandler'}-&gt;processing_instruction(@_) };
            if ($@) {
                die $@;
            }
            else {
                # I think there's a buggette here...
                # if the first call throws an exception, we don't set it up right.
                # Not fatal, but we might want to address it.
                my $handler = $callbacks-&gt;{'DocumentHandler'};
                $self-&gt;{Methods}-&gt;{'processing_instruction'} = sub { $handler-&gt;processing_instruction(@_) };
            }
            return $res;
        }
        elsif (defined $callbacks-&gt;{'Handler'} 
        	and $callbacks-&gt;{'Handler'}-&gt;can('AUTOLOAD')
        	and $callbacks-&gt;{'Handler'}-&gt;can('AUTOLOAD') ne (UNIVERSAL-&gt;can('AUTOLOAD') || '')
        	)
        {
            my $res = eval { $callbacks-&gt;{'Handler'}-&gt;processing_instruction(@_) };
            if ($@) {
                die $@;
            }
            else {
                # I think there's a buggette here...
                # if the first call throws an exception, we don't set it up right.
                # Not fatal, but we might want to address it.
                my $handler = $callbacks-&gt;{'Handler'};
                $self-&gt;{Methods}-&gt;{'processing_instruction'} = sub { $handler-&gt;processing_instruction(@_) };
            }
            return $res;
        }
        else {
            $self-&gt;{Methods}-&gt;{'processing_instruction'} = sub { };
        }
    }

}

sub attribute_decl {
    my $self = shift;
    if (defined $self-&gt;{Methods}-&gt;{'attribute_decl'}) {
        $self-&gt;{Methods}-&gt;{'attribute_decl'}-&gt;(@_);
    }
    else {
        my $method;
        my $callbacks;
        if (exists $self-&gt;{ParseOptions}) {
            $callbacks = $self-&gt;{ParseOptions};
        }
        else {
            $callbacks = $self;
        }
        if (0) { # dummy to make elsif's below compile
        }
        elsif (defined $callbacks-&gt;{'DeclHandler'} and $method = $callbacks-&gt;{'DeclHandler'}-&gt;can('attribute_decl') ) {
            my $handler = $callbacks-&gt;{'DeclHandler'};
            $self-&gt;{Methods}-&gt;{'attribute_decl'} = sub { $method-&gt;($handler, @_) };
            return $method-&gt;($handler, @_);
        }
        elsif (defined $callbacks-&gt;{'Handler'} and $method = $callbacks-&gt;{'Handler'}-&gt;can('attribute_decl') ) {
            my $handler = $callbacks-&gt;{'Handler'};
            $self-&gt;{Methods}-&gt;{'attribute_decl'} = sub { $method-&gt;($handler, @_) };
            return $method-&gt;($handler, @_);
        }
        elsif (defined $callbacks-&gt;{'DeclHandler'} 
        	and $callbacks-&gt;{'DeclHandler'}-&gt;can('AUTOLOAD')
        	and $callbacks-&gt;{'DeclHandler'}-&gt;can('AUTOLOAD') ne (UNIVERSAL-&gt;can('AUTOLOAD') || '')
        	)
        {
            my $res = eval { $callbacks-&gt;{'DeclHandler'}-&gt;attribute_decl(@_) };
            if ($@) {
                die $@;
            }
            else {
                # I think there's a buggette here...
                # if the first call throws an exception, we don't set it up right.
                # Not fatal, but we might want to address it.
                my $handler = $callbacks-&gt;{'DeclHandler'};
                $self-&gt;{Methods}-&gt;{'attribute_decl'} = sub { $handler-&gt;attribute_decl(@_) };
            }
            return $res;
        }
        elsif (defined $callbacks-&gt;{'Handler'} 
        	and $callbacks-&gt;{'Handler'}-&gt;can('AUTOLOAD')
        	and $callbacks-&gt;{'Handler'}-&gt;can('AUTOLOAD') ne (UNIVERSAL-&gt;can('AUTOLOAD') || '')
        	)
        {
            my $res = eval { $callbacks-&gt;{'Handler'}-&gt;attribute_decl(@_) };
            if ($@) {
                die $@;
            }
            else {
                # I think there's a buggette here...
                # if the first call throws an exception, we don't set it up right.
                # Not fatal, but we might want to address it.
                my $handler = $callbacks-&gt;{'Handler'};
                $self-&gt;{Methods}-&gt;{'attribute_decl'} = sub { $handler-&gt;attribute_decl(@_) };
            }
            return $res;
        }
        else {
            $self-&gt;{Methods}-&gt;{'attribute_decl'} = sub { };
        }
    }

}

sub fatal_error {
    my $self = shift;
    if (defined $self-&gt;{Methods}-&gt;{'fatal_error'}) {
        $self-&gt;{Methods}-&gt;{'fatal_error'}-&gt;(@_);
    }
    else {
        my $method;
        my $callbacks;
        if (exists $self-&gt;{ParseOptions}) {
            $callbacks = $self-&gt;{ParseOptions};
        }
        else {
            $callbacks = $self;
        }
        if (0) { # dummy to make elsif's below compile
        }
        elsif (defined $callbacks-&gt;{'ErrorHandler'} and $method = $callbacks-&gt;{'ErrorHandler'}-&gt;can('fatal_error') ) {
            my $handler = $callbacks-&gt;{'ErrorHandler'};
            $self-&gt;{Methods}-&gt;{'fatal_error'} = sub { $method-&gt;($handler, @_) };
            return $method-&gt;($handler, @_);
        }
        elsif (defined $callbacks-&gt;{'Handler'} and $method = $callbacks-&gt;{'Handler'}-&gt;can('fatal_error') ) {
            my $handler = $callbacks-&gt;{'Handler'};
            $self-&gt;{Methods}-&gt;{'fatal_error'} = sub { $method-&gt;($handler, @_) };
            return $method-&gt;($handler, @_);
        }
        elsif (defined $callbacks-&gt;{'ErrorHandler'} 
        	and $callbacks-&gt;{'ErrorHandler'}-&gt;can('AUTOLOAD')
        	and $callbacks-&gt;{'ErrorHandler'}-&gt;can('AUTOLOAD') ne (UNIVERSAL-&gt;can('AUTOLOAD') || '')
        	)
        {
            my $res = eval { $callbacks-&gt;{'ErrorHandler'}-&gt;fatal_error(@_) };
            if ($@) {
                die $@;
            }
            else {
                # I think there's a buggette here...
                # if the first call throws an exception, we don't set it up right.
                # Not fatal, but we might want to address it.
                my $handler = $callbacks-&gt;{'ErrorHandler'};
                $self-&gt;{Methods}-&gt;{'fatal_error'} = sub { $handler-&gt;fatal_error(@_) };
            }
            return $res;
        }
        elsif (defined $callbacks-&gt;{'Handler'} 
        	and $callbacks-&gt;{'Handler'}-&gt;can('AUTOLOAD')
        	and $callbacks-&gt;{'Handler'}-&gt;can('AUTOLOAD') ne (UNIVERSAL-&gt;can('AUTOLOAD') || '')
        	)
        {
            my $res = eval { $callbacks-&gt;{'Handler'}-&gt;fatal_error(@_) };
            if ($@) {
                die $@;
            }
            else {
                # I think there's a buggette here...
                # if the first call throws an exception, we don't set it up right.
                # Not fatal, but we might want to address it.
                my $handler = $callbacks-&gt;{'Handler'};
                $self-&gt;{Methods}-&gt;{'fatal_error'} = sub { $handler-&gt;fatal_error(@_) };
            }
            return $res;
        }
        else {
            $self-&gt;{Methods}-&gt;{'fatal_error'} = sub { };
        }
    }

}

sub end_cdata {
    my $self = shift;
    if (defined $self-&gt;{Methods}-&gt;{'end_cdata'}) {
        $self-&gt;{Methods}-&gt;{'end_cdata'}-&gt;(@_);
    }
    else {
        my $method;
        my $callbacks;
        if (exists $self-&gt;{ParseOptions}) {
            $callbacks = $self-&gt;{ParseOptions};
        }
        else {
            $callbacks = $self;
        }
        if (0) { # dummy to make elsif's below compile
        }
        elsif (defined $callbacks-&gt;{'DocumentHandler'} and $method = $callbacks-&gt;{'DocumentHandler'}-&gt;can('end_cdata') ) {
            my $handler = $callbacks-&gt;{'DocumentHandler'};
            $self-&gt;{Methods}-&gt;{'end_cdata'} = sub { $method-&gt;($handler, @_) };
            return $method-&gt;($handler, @_);
        }
        elsif (defined $callbacks-&gt;{'LexicalHandler'} and $method = $callbacks-&gt;{'LexicalHandler'}-&gt;can('end_cdata') ) {
            my $handler = $callbacks-&gt;{'LexicalHandler'};
            $self-&gt;{Methods}-&gt;{'end_cdata'} = sub { $method-&gt;($handler, @_) };
            return $method-&gt;($handler, @_);
        }
        elsif (defined $callbacks-&gt;{'Handler'} and $method = $callbacks-&gt;{'Handler'}-&gt;can('end_cdata') ) {
            my $handler = $callbacks-&gt;{'Handler'};
            $self-&gt;{Methods}-&gt;{'end_cdata'} = sub { $method-&gt;($handler, @_) };
            return $method-&gt;($handler, @_);
        }
        elsif (defined $callbacks-&gt;{'DocumentHandler'} 
        	and $callbacks-&gt;{'DocumentHandler'}-&gt;can('AUTOLOAD')
        	and $callbacks-&gt;{'DocumentHandler'}-&gt;can('AUTOLOAD') ne (UNIVERSAL-&gt;can('AUTOLOAD') || '')
        	)
        {
            my $res = eval { $callbacks-&gt;{'DocumentHandler'}-&gt;end_cdata(@_) };
            if ($@) {
                die $@;
            }
            else {
                # I think there's a buggette here...
                # if the first call throws an exception, we don't set it up right.
                # Not fatal, but we might want to address it.
                my $handler = $callbacks-&gt;{'DocumentHandler'};
                $self-&gt;{Methods}-&gt;{'end_cdata'} = sub { $handler-&gt;end_cdata(@_) };
            }
            return $res;
        }
        elsif (defined $callbacks-&gt;{'LexicalHandler'} 
        	and $callbacks-&gt;{'LexicalHandler'}-&gt;can('AUTOLOAD')
        	and $callbacks-&gt;{'LexicalHandler'}-&gt;can('AUTOLOAD') ne (UNIVERSAL-&gt;can('AUTOLOAD') || '')
        	)
        {
            my $res = eval { $callbacks-&gt;{'LexicalHandler'}-&gt;end_cdata(@_) };
            if ($@) {
                die $@;
            }
            else {
                # I think there's a buggette here...
                # if the first call throws an exception, we don't set it up right.
                # Not fatal, but we might want to address it.
                my $handler = $callbacks-&gt;{'LexicalHandler'};
                $self-&gt;{Methods}-&gt;{'end_cdata'} = sub { $handler-&gt;end_cdata(@_) };
            }
            return $res;
        }
        elsif (defined $callbacks-&gt;{'Handler'} 
        	and $callbacks-&gt;{'Handler'}-&gt;can('AUTOLOAD')
        	and $callbacks-&gt;{'Handler'}-&gt;can('AUTOLOAD') ne (UNIVERSAL-&gt;can('AUTOLOAD') || '')
        	)
        {
            my $res = eval { $callbacks-&gt;{'Handler'}-&gt;end_cdata(@_) };
            if ($@) {
                die $@;
            }
            else {
                # I think there's a buggette here...
                # if the first call throws an exception, we don't set it up right.
                # Not fatal, but we might want to address it.
                my $handler = $callbacks-&gt;{'Handler'};
                $self-&gt;{Methods}-&gt;{'end_cdata'} = sub { $handler-&gt;end_cdata(@_) };
            }
            return $res;
        }
        else {
            $self-&gt;{Methods}-&gt;{'end_cdata'} = sub { };
        }
    }

}

sub start_entity {
    my $self = shift;
    if (defined $self-&gt;{Methods}-&gt;{'start_entity'}) {
        $self-&gt;{Methods}-&gt;{'start_entity'}-&gt;(@_);
    }
    else {
        my $method;
        my $callbacks;
        if (exists $self-&gt;{ParseOptions}) {
            $callbacks = $self-&gt;{ParseOptions};
        }
        else {
            $callbacks = $self;
        }
        if (0) { # dummy to make elsif's below compile
        }
        elsif (defined $callbacks-&gt;{'LexicalHandler'} and $method = $callbacks-&gt;{'LexicalHandler'}-&gt;can('start_entity') ) {
            my $handler = $callbacks-&gt;{'LexicalHandler'};
            $self-&gt;{Methods}-&gt;{'start_entity'} = sub { $method-&gt;($handler, @_) };
            return $method-&gt;($handler, @_);
        }
        elsif (defined $callbacks-&gt;{'Handler'} and $method = $callbacks-&gt;{'Handler'}-&gt;can('start_entity') ) {
            my $handler = $callbacks-&gt;{'Handler'};
            $self-&gt;{Methods}-&gt;{'start_entity'} = sub { $method-&gt;($handler, @_) };
            return $method-&gt;($handler, @_);
        }
        elsif (defined $callbacks-&gt;{'LexicalHandler'} 
        	and $callbacks-&gt;{'LexicalHandler'}-&gt;can('AUTOLOAD')
        	and $callbacks-&gt;{'LexicalHandler'}-&gt;can('AUTOLOAD') ne (UNIVERSAL-&gt;can('AUTOLOAD') || '')
        	)
        {
            my $res = eval { $callbacks-&gt;{'LexicalHandler'}-&gt;start_entity(@_) };
            if ($@) {
                die $@;
            }
            else {
                # I think there's a buggette here...
                # if the first call throws an exception, we don't set it up right.
                # Not fatal, but we might want to address it.
                my $handler = $callbacks-&gt;{'LexicalHandler'};
                $self-&gt;{Methods}-&gt;{'start_entity'} = sub { $handler-&gt;start_entity(@_) };
            }
            return $res;
        }
        elsif (defined $callbacks-&gt;{'Handler'} 
        	and $callbacks-&gt;{'Handler'}-&gt;can('AUTOLOAD')
        	and $callbacks-&gt;{'Handler'}-&gt;can('AUTOLOAD') ne (UNIVERSAL-&gt;can('AUTOLOAD') || '')
        	)
        {
            my $res = eval { $callbacks-&gt;{'Handler'}-&gt;start_entity(@_) };
            if ($@) {
                die $@;
            }
            else {
                # I think there's a buggette here...
                # if the first call throws an exception, we don't set it up right.
                # Not fatal, but we might want to address it.
                my $handler = $callbacks-&gt;{'Handler'};
                $self-&gt;{Methods}-&gt;{'start_entity'} = sub { $handler-&gt;start_entity(@_) };
            }
            return $res;
        }
        else {
            $self-&gt;{Methods}-&gt;{'start_entity'} = sub { };
        }
    }

}

sub start_prefix_mapping {
    my $self = shift;
    if (defined $self-&gt;{Methods}-&gt;{'start_prefix_mapping'}) {
        $self-&gt;{Methods}-&gt;{'start_prefix_mapping'}-&gt;(@_);
    }
    else {
        my $method;
        my $callbacks;
        if (exists $self-&gt;{ParseOptions}) {
            $callbacks = $self-&gt;{ParseOptions};
        }
        else {
            $callbacks = $self;
        }
        if (0) { # dummy to make elsif's below compile
        }
        elsif (defined $callbacks-&gt;{'ContentHandler'} and $method = $callbacks-&gt;{'ContentHandler'}-&gt;can('start_prefix_mapping') ) {
            my $handler = $callbacks-&gt;{'ContentHandler'};
            $self-&gt;{Methods}-&gt;{'start_prefix_mapping'} = sub { $method-&gt;($handler, @_) };
            return $method-&gt;($handler, @_);
        }
        elsif (defined $callbacks-&gt;{'Handler'} and $method = $callbacks-&gt;{'Handler'}-&gt;can('start_prefix_mapping') ) {
            my $handler = $callbacks-&gt;{'Handler'};
            $self-&gt;{Methods}-&gt;{'start_prefix_mapping'} = sub { $method-&gt;($handler, @_) };
            return $method-&gt;($handler, @_);
        }
        elsif (defined $callbacks-&gt;{'ContentHandler'} 
        	and $callbacks-&gt;{'ContentHandler'}-&gt;can('AUTOLOAD')
        	and $callbacks-&gt;{'ContentHandler'}-&gt;can('AUTOLOAD') ne (UNIVERSAL-&gt;can('AUTOLOAD') || '')
        	)
        {
            my $res = eval { $callbacks-&gt;{'ContentHandler'}-&gt;start_prefix_mapping(@_) };
            if ($@) {
                die $@;
            }
            else {
                # I think there's a buggette here...
                # if the first call throws an exception, we don't set it up right.
                # Not fatal, but we might want to address it.
                my $handler = $callbacks-&gt;{'ContentHandler'};
                $self-&gt;{Methods}-&gt;{'start_prefix_mapping'} = sub { $handler-&gt;start_prefix_mapping(@_) };
            }
            return $res;
        }
        elsif (defined $callbacks-&gt;{'Handler'} 
        	and $callbacks-&gt;{'Handler'}-&gt;can('AUTOLOAD')
        	and $callbacks-&gt;{'Handler'}-&gt;can('AUTOLOAD') ne (UNIVERSAL-&gt;can('AUTOLOAD') || '')
        	)
        {
            my $res = eval { $callbacks-&gt;{'Handler'}-&gt;start_prefix_mapping(@_) };
            if ($@) {
                die $@;
            }
            else {
                # I think there's a buggette here...
                # if the first call throws an exception, we don't set it up right.
                # Not fatal, but we might want to address it.
                my $handler = $callbacks-&gt;{'Handler'};
                $self-&gt;{Methods}-&gt;{'start_prefix_mapping'} = sub { $handler-&gt;start_prefix_mapping(@_) };
            }
            return $res;
        }
        else {
            $self-&gt;{Methods}-&gt;{'start_prefix_mapping'} = sub { };
        }
    }

}

sub error {
    my $self = shift;
    if (defined $self-&gt;{Methods}-&gt;{'error'}) {
        $self-&gt;{Methods}-&gt;{'error'}-&gt;(@_);
    }
    else {
        my $method;
        my $callbacks;
        if (exists $self-&gt;{ParseOptions}) {
            $callbacks = $self-&gt;{ParseOptions};
        }
        else {
            $callbacks = $self;
        }
        if (0) { # dummy to make elsif's below compile
        }
        elsif (defined $callbacks-&gt;{'ErrorHandler'} and $method = $callbacks-&gt;{'ErrorHandler'}-&gt;can('error') ) {
            my $handler = $callbacks-&gt;{'ErrorHandler'};
            $self-&gt;{Methods}-&gt;{'error'} = sub { $method-&gt;($handler, @_) };
            return $method-&gt;($handler, @_);
        }
        elsif (defined $callbacks-&gt;{'Handler'} and $method = $callbacks-&gt;{'Handler'}-&gt;can('error') ) {
            my $handler = $callbacks-&gt;{'Handler'};
            $self-&gt;{Methods}-&gt;{'error'} = sub { $method-&gt;($handler, @_) };
            return $method-&gt;($handler, @_);
        }
        elsif (defined $callbacks-&gt;{'ErrorHandler'} 
        	and $callbacks-&gt;{'ErrorHandler'}-&gt;can('AUTOLOAD')
        	and $callbacks-&gt;{'ErrorHandler'}-&gt;can('AUTOLOAD') ne (UNIVERSAL-&gt;can('AUTOLOAD') || '')
        	)
        {
            my $res = eval { $callbacks-&gt;{'ErrorHandler'}-&gt;error(@_) };
            if ($@) {
                die $@;
            }
            else {
                # I think there's a buggette here...
                # if the first call throws an exception, we don't set it up right.
                # Not fatal, but we might want to address it.
                my $handler = $callbacks-&gt;{'ErrorHandler'};
                $self-&gt;{Methods}-&gt;{'error'} = sub { $handler-&gt;error(@_) };
            }
            return $res;
        }
        elsif (defined $callbacks-&gt;{'Handler'} 
        	and $callbacks-&gt;{'Handler'}-&gt;can('AUTOLOAD')
        	and $callbacks-&gt;{'Handler'}-&gt;can('AUTOLOAD') ne (UNIVERSAL-&gt;can('AUTOLOAD') || '')
        	)
        {
            my $res = eval { $callbacks-&gt;{'Handler'}-&gt;error(@_) };
            if ($@) {
                die $@;
            }
            else {
                # I think there's a buggette here...
                # if the first call throws an exception, we don't set it up right.
                # Not fatal, but we might want to address it.
                my $handler = $callbacks-&gt;{'Handler'};
                $self-&gt;{Methods}-&gt;{'error'} = sub { $handler-&gt;error(@_) };
            }
            return $res;
        }
        else {
            $self-&gt;{Methods}-&gt;{'error'} = sub { };
        }
    }

}

sub start_document {
    my $self = shift;
    if (defined $self-&gt;{Methods}-&gt;{'start_document'}) {
        $self-&gt;{Methods}-&gt;{'start_document'}-&gt;(@_);
    }
    else {
        my $method;
        my $callbacks;
        if (exists $self-&gt;{ParseOptions}) {
            $callbacks = $self-&gt;{ParseOptions};
        }
        else {
            $callbacks = $self;
        }
        if (0) { # dummy to make elsif's below compile
        }
        elsif (defined $callbacks-&gt;{'ContentHandler'} and $method = $callbacks-&gt;{'ContentHandler'}-&gt;can('start_document') ) {
            my $handler = $callbacks-&gt;{'ContentHandler'};
            $self-&gt;{Methods}-&gt;{'start_document'} = sub { $method-&gt;($handler, @_) };
            return $method-&gt;($handler, @_);
        }
        elsif (defined $callbacks-&gt;{'DocumentHandler'} and $method = $callbacks-&gt;{'DocumentHandler'}-&gt;can('start_document') ) {
            my $handler = $callbacks-&gt;{'DocumentHandler'};
            $self-&gt;{Methods}-&gt;{'start_document'} = sub { $method-&gt;($handler, @_) };
            return $method-&gt;($handler, @_);
        }
        elsif (defined $callbacks-&gt;{'Handler'} and $method = $callbacks-&gt;{'Handler'}-&gt;can('start_document') ) {
            my $handler = $callbacks-&gt;{'Handler'};
            $self-&gt;{Methods}-&gt;{'start_document'} = sub { $method-&gt;($handler, @_) };
            return $method-&gt;($handler, @_);
        }
        elsif (defined $callbacks-&gt;{'ContentHandler'} 
        	and $callbacks-&gt;{'ContentHandler'}-&gt;can('AUTOLOAD')
        	and $callbacks-&gt;{'ContentHandler'}-&gt;can('AUTOLOAD') ne (UNIVERSAL-&gt;can('AUTOLOAD') || '')
        	)
        {
            my $res = eval { $callbacks-&gt;{'ContentHandler'}-&gt;start_document(@_) };
            if ($@) {
                die $@;
            }
            else {
                # I think there's a buggette here...
                # if the first call throws an exception, we don't set it up right.
                # Not fatal, but we might want to address it.
                my $handler = $callbacks-&gt;{'ContentHandler'};
                $self-&gt;{Methods}-&gt;{'start_document'} = sub { $handler-&gt;start_document(@_) };
            }
            return $res;
        }
        elsif (defined $callbacks-&gt;{'DocumentHandler'} 
        	and $callbacks-&gt;{'DocumentHandler'}-&gt;can('AUTOLOAD')
        	and $callbacks-&gt;{'DocumentHandler'}-&gt;can('AUTOLOAD') ne (UNIVERSAL-&gt;can('AUTOLOAD') || '')
        	)
        {
            my $res = eval { $callbacks-&gt;{'DocumentHandler'}-&gt;start_document(@_) };
            if ($@) {
                die $@;
            }
            else {
                # I think there's a buggette here...
                # if the first call throws an exception, we don't set it up right.
                # Not fatal, but we might want to address it.
                my $handler = $callbacks-&gt;{'DocumentHandler'};
                $self-&gt;{Methods}-&gt;{'start_document'} = sub { $handler-&gt;start_document(@_) };
            }
            return $res;
        }
        elsif (defined $callbacks-&gt;{'Handler'} 
        	and $callbacks-&gt;{'Handler'}-&gt;can('AUTOLOAD')
        	and $callbacks-&gt;{'Handler'}-&gt;can('AUTOLOAD') ne (UNIVERSAL-&gt;can('AUTOLOAD') || '')
        	)
        {
            my $res = eval { $callbacks-&gt;{'Handler'}-&gt;start_document(@_) };
            if ($@) {
                die $@;
            }
            else {
                # I think there's a buggette here...
                # if the first call throws an exception, we don't set it up right.
                # Not fatal, but we might want to address it.
                my $handler = $callbacks-&gt;{'Handler'};
                $self-&gt;{Methods}-&gt;{'start_document'} = sub { $handler-&gt;start_document(@_) };
            }
            return $res;
        }
        else {
            $self-&gt;{Methods}-&gt;{'start_document'} = sub { };
        }
    }

}

sub ignorable_whitespace {
    my $self = shift;
    if (defined $self-&gt;{Methods}-&gt;{'ignorable_whitespace'}) {
        $self-&gt;{Methods}-&gt;{'ignorable_whitespace'}-&gt;(@_);
    }
    else {
        my $method;
        my $callbacks;
        if (exists $self-&gt;{ParseOptions}) {
            $callbacks = $self-&gt;{ParseOptions};
        }
        else {
            $callbacks = $self;
        }
        if (0) { # dummy to make elsif's below compile
        }
        elsif (defined $callbacks-&gt;{'ContentHandler'} and $method = $callbacks-&gt;{'ContentHandler'}-&gt;can('ignorable_whitespace') ) {
            my $handler = $callbacks-&gt;{'ContentHandler'};
            $self-&gt;{Methods}-&gt;{'ignorable_whitespace'} = sub { $method-&gt;($handler, @_) };
            return $method-&gt;($handler, @_);
        }
        elsif (defined $callbacks-&gt;{'DocumentHandler'} and $method = $callbacks-&gt;{'DocumentHandler'}-&gt;can('ignorable_whitespace') ) {
            my $handler = $callbacks-&gt;{'DocumentHandler'};
            $self-&gt;{Methods}-&gt;{'ignorable_whitespace'} = sub { $method-&gt;($handler, @_) };
            return $method-&gt;($handler, @_);
        }
        elsif (defined $callbacks-&gt;{'Handler'} and $method = $callbacks-&gt;{'Handler'}-&gt;can('ignorable_whitespace') ) {
            my $handler = $callbacks-&gt;{'Handler'};
            $self-&gt;{Methods}-&gt;{'ignorable_whitespace'} = sub { $method-&gt;($handler, @_) };
            return $method-&gt;($handler, @_);
        }
        elsif (defined $callbacks-&gt;{'ContentHandler'} 
        	and $callbacks-&gt;{'ContentHandler'}-&gt;can('AUTOLOAD')
        	and $callbacks-&gt;{'ContentHandler'}-&gt;can('AUTOLOAD') ne (UNIVERSAL-&gt;can('AUTOLOAD') || '')
        	)
        {
            my $res = eval { $callbacks-&gt;{'ContentHandler'}-&gt;ignorable_whitespace(@_) };
            if ($@) {
                die $@;
            }
            else {
                # I think there's a buggette here...
                # if the first call throws an exception, we don't set it up right.
                # Not fatal, but we might want to address it.
                my $handler = $callbacks-&gt;{'ContentHandler'};
                $self-&gt;{Methods}-&gt;{'ignorable_whitespace'} = sub { $handler-&gt;ignorable_whitespace(@_) };
            }
            return $res;
        }
        elsif (defined $callbacks-&gt;{'DocumentHandler'} 
        	and $callbacks-&gt;{'DocumentHandler'}-&gt;can('AUTOLOAD')
        	and $callbacks-&gt;{'DocumentHandler'}-&gt;can('AUTOLOAD') ne (UNIVERSAL-&gt;can('AUTOLOAD') || '')
        	)
        {
            my $res = eval { $callbacks-&gt;{'DocumentHandler'}-&gt;ignorable_whitespace(@_) };
            if ($@) {
                die $@;
            }
            else {
                # I think there's a buggette here...
                # if the first call throws an exception, we don't set it up right.
                # Not fatal, but we might want to address it.
                my $handler = $callbacks-&gt;{'DocumentHandler'};
                $self-&gt;{Methods}-&gt;{'ignorable_whitespace'} = sub { $handler-&gt;ignorable_whitespace(@_) };
            }
            return $res;
        }
        elsif (defined $callbacks-&gt;{'Handler'} 
        	and $callbacks-&gt;{'Handler'}-&gt;can('AUTOLOAD')
        	and $callbacks-&gt;{'Handler'}-&gt;can('AUTOLOAD') ne (UNIVERSAL-&gt;can('AUTOLOAD') || '')
        	)
        {
            my $res = eval { $callbacks-&gt;{'Handler'}-&gt;ignorable_whitespace(@_) };
            if ($@) {
                die $@;
            }
            else {
                # I think there's a buggette here...
                # if the first call throws an exception, we don't set it up right.
                # Not fatal, but we might want to address it.
                my $handler = $callbacks-&gt;{'Handler'};
                $self-&gt;{Methods}-&gt;{'ignorable_whitespace'} = sub { $handler-&gt;ignorable_whitespace(@_) };
            }
            return $res;
        }
        else {
            $self-&gt;{Methods}-&gt;{'ignorable_whitespace'} = sub { };
        }
    }

}

sub end_document {
    my $self = shift;
    if (defined $self-&gt;{Methods}-&gt;{'end_document'}) {
        $self-&gt;{Methods}-&gt;{'end_document'}-&gt;(@_);
    }
    else {
        my $method;
        my $callbacks;
        if (exists $self-&gt;{ParseOptions}) {
            $callbacks = $self-&gt;{ParseOptions};
        }
        else {
            $callbacks = $self;
        }
        if (0) { # dummy to make elsif's below compile
        }
        elsif (defined $callbacks-&gt;{'ContentHandler'} and $method = $callbacks-&gt;{'ContentHandler'}-&gt;can('end_document') ) {
            my $handler = $callbacks-&gt;{'ContentHandler'};
            $self-&gt;{Methods}-&gt;{'end_document'} = sub { $method-&gt;($handler, @_) };
            return $method-&gt;($handler, @_);
        }
        elsif (defined $callbacks-&gt;{'DocumentHandler'} and $method = $callbacks-&gt;{'DocumentHandler'}-&gt;can('end_document') ) {
            my $handler = $callbacks-&gt;{'DocumentHandler'};
            $self-&gt;{Methods}-&gt;{'end_document'} = sub { $method-&gt;($handler, @_) };
            return $method-&gt;($handler, @_);
        }
        elsif (defined $callbacks-&gt;{'Handler'} and $method = $callbacks-&gt;{'Handler'}-&gt;can('end_document') ) {
            my $handler = $callbacks-&gt;{'Handler'};
            $self-&gt;{Methods}-&gt;{'end_document'} = sub { $method-&gt;($handler, @_) };
            return $method-&gt;($handler, @_);
        }
        elsif (defined $callbacks-&gt;{'ContentHandler'} 
        	and $callbacks-&gt;{'ContentHandler'}-&gt;can('AUTOLOAD')
        	and $callbacks-&gt;{'ContentHandler'}-&gt;can('AUTOLOAD') ne (UNIVERSAL-&gt;can('AUTOLOAD') || '')
        	)
        {
            my $res = eval { $callbacks-&gt;{'ContentHandler'}-&gt;end_document(@_) };
            if ($@) {
                die $@;
            }
            else {
                # I think there's a buggette here...
                # if the first call throws an exception, we don't set it up right.
                # Not fatal, but we might want to address it.
                my $handler = $callbacks-&gt;{'ContentHandler'};
                $self-&gt;{Methods}-&gt;{'end_document'} = sub { $handler-&gt;end_document(@_) };
            }
            return $res;
        }
        elsif (defined $callbacks-&gt;{'DocumentHandler'} 
        	and $callbacks-&gt;{'DocumentHandler'}-&gt;can('AUTOLOAD')
        	and $callbacks-&gt;{'DocumentHandler'}-&gt;can('AUTOLOAD') ne (UNIVERSAL-&gt;can('AUTOLOAD') || '')
        	)
        {
            my $res = eval { $callbacks-&gt;{'DocumentHandler'}-&gt;end_document(@_) };
            if ($@) {
                die $@;
            }
            else {
                # I think there's a buggette here...
                # if the first call throws an exception, we don't set it up right.
                # Not fatal, but we might want to address it.
                my $handler = $callbacks-&gt;{'DocumentHandler'};
                $self-&gt;{Methods}-&gt;{'end_document'} = sub { $handler-&gt;end_document(@_) };
            }
            return $res;
        }
        elsif (defined $callbacks-&gt;{'Handler'} 
        	and $callbacks-&gt;{'Handler'}-&gt;can('AUTOLOAD')
        	and $callbacks-&gt;{'Handler'}-&gt;can('AUTOLOAD') ne (UNIVERSAL-&gt;can('AUTOLOAD') || '')
        	)
        {
            my $res = eval { $callbacks-&gt;{'Handler'}-&gt;end_document(@_) };
            if ($@) {
                die $@;
            }
            else {
                # I think there's a buggette here...
                # if the first call throws an exception, we don't set it up right.
                # Not fatal, but we might want to address it.
                my $handler = $callbacks-&gt;{'Handler'};
                $self-&gt;{Methods}-&gt;{'end_document'} = sub { $handler-&gt;end_document(@_) };
            }
            return $res;
        }
        else {
            $self-&gt;{Methods}-&gt;{'end_document'} = sub { };
        }
    }

}

sub start_cdata {
    my $self = shift;
    if (defined $self-&gt;{Methods}-&gt;{'start_cdata'}) {
        $self-&gt;{Methods}-&gt;{'start_cdata'}-&gt;(@_);
    }
    else {
        my $method;
        my $callbacks;
        if (exists $self-&gt;{ParseOptions}) {
            $callbacks = $self-&gt;{ParseOptions};
        }
        else {
            $callbacks = $self;
        }
        if (0) { # dummy to make elsif's below compile
        }
        elsif (defined $callbacks-&gt;{'DocumentHandler'} and $method = $callbacks-&gt;{'DocumentHandler'}-&gt;can('start_cdata') ) {
            my $handler = $callbacks-&gt;{'DocumentHandler'};
            $self-&gt;{Methods}-&gt;{'start_cdata'} = sub { $method-&gt;($handler, @_) };
            return $method-&gt;($handler, @_);
        }
        elsif (defined $callbacks-&gt;{'LexicalHandler'} and $method = $callbacks-&gt;{'LexicalHandler'}-&gt;can('start_cdata') ) {
            my $handler = $callbacks-&gt;{'LexicalHandler'};
            $self-&gt;{Methods}-&gt;{'start_cdata'} = sub { $method-&gt;($handler, @_) };
            return $method-&gt;($handler, @_);
        }
        elsif (defined $callbacks-&gt;{'Handler'} and $method = $callbacks-&gt;{'Handler'}-&gt;can('start_cdata') ) {
            my $handler = $callbacks-&gt;{'Handler'};
            $self-&gt;{Methods}-&gt;{'start_cdata'} = sub { $method-&gt;($handler, @_) };
            return $method-&gt;($handler, @_);
        }
        elsif (defined $callbacks-&gt;{'DocumentHandler'} 
        	and $callbacks-&gt;{'DocumentHandler'}-&gt;can('AUTOLOAD')
        	and $callbacks-&gt;{'DocumentHandler'}-&gt;can('AUTOLOAD') ne (UNIVERSAL-&gt;can('AUTOLOAD') || '')
        	)
        {
            my $res = eval { $callbacks-&gt;{'DocumentHandler'}-&gt;start_cdata(@_) };
            if ($@) {
                die $@;
            }
            else {
                # I think there's a buggette here...
                # if the first call throws an exception, we don't set it up right.
                # Not fatal, but we might want to address it.
                my $handler = $callbacks-&gt;{'DocumentHandler'};
                $self-&gt;{Methods}-&gt;{'start_cdata'} = sub { $handler-&gt;start_cdata(@_) };
            }
            return $res;
        }
        elsif (defined $callbacks-&gt;{'LexicalHandler'} 
        	and $callbacks-&gt;{'LexicalHandler'}-&gt;can('AUTOLOAD')
        	and $callbacks-&gt;{'LexicalHandler'}-&gt;can('AUTOLOAD') ne (UNIVERSAL-&gt;can('AUTOLOAD') || '')
        	)
        {
            my $res = eval { $callbacks-&gt;{'LexicalHandler'}-&gt;start_cdata(@_) };
            if ($@) {
                die $@;
            }
            else {
                # I think there's a buggette here...
                # if the first call throws an exception, we don't set it up right.
                # Not fatal, but we might want to address it.
                my $handler = $callbacks-&gt;{'LexicalHandler'};
                $self-&gt;{Methods}-&gt;{'start_cdata'} = sub { $handler-&gt;start_cdata(@_) };
            }
            return $res;
        }
        elsif (defined $callbacks-&gt;{'Handler'} 
        	and $callbacks-&gt;{'Handler'}-&gt;can('AUTOLOAD')
        	and $callbacks-&gt;{'Handler'}-&gt;can('AUTOLOAD') ne (UNIVERSAL-&gt;can('AUTOLOAD') || '')
        	)
        {
            my $res = eval { $callbacks-&gt;{'Handler'}-&gt;start_cdata(@_) };
            if ($@) {
                die $@;
            }
            else {
                # I think there's a buggette here...
                # if the first call throws an exception, we don't set it up right.
                # Not fatal, but we might want to address it.
                my $handler = $callbacks-&gt;{'Handler'};
                $self-&gt;{Methods}-&gt;{'start_cdata'} = sub { $handler-&gt;start_cdata(@_) };
            }
            return $res;
        }
        else {
            $self-&gt;{Methods}-&gt;{'start_cdata'} = sub { };
        }
    }

}

sub set_document_locator {
    my $self = shift;
    if (defined $self-&gt;{Methods}-&gt;{'set_document_locator'}) {
        $self-&gt;{Methods}-&gt;{'set_document_locator'}-&gt;(@_);
    }
    else {
        my $method;
        my $callbacks;
        if (exists $self-&gt;{ParseOptions}) {
            $callbacks = $self-&gt;{ParseOptions};
        }
        else {
            $callbacks = $self;
        }
        if (0) { # dummy to make elsif's below compile
        }
        elsif (defined $callbacks-&gt;{'ContentHandler'} and $method = $callbacks-&gt;{'ContentHandler'}-&gt;can('set_document_locator') ) {
            my $handler = $callbacks-&gt;{'ContentHandler'};
            $self-&gt;{Methods}-&gt;{'set_document_locator'} = sub { $method-&gt;($handler, @_) };
            return $method-&gt;($handler, @_);
        }
        elsif (defined $callbacks-&gt;{'DocumentHandler'} and $method = $callbacks-&gt;{'DocumentHandler'}-&gt;can('set_document_locator') ) {
            my $handler = $callbacks-&gt;{'DocumentHandler'};
            $self-&gt;{Methods}-&gt;{'set_document_locator'} = sub { $method-&gt;($handler, @_) };
            return $method-&gt;($handler, @_);
        }
        elsif (defined $callbacks-&gt;{'Handler'} and $method = $callbacks-&gt;{'Handler'}-&gt;can('set_document_locator') ) {
            my $handler = $callbacks-&gt;{'Handler'};
            $self-&gt;{Methods}-&gt;{'set_document_locator'} = sub { $method-&gt;($handler, @_) };
            return $method-&gt;($handler, @_);
        }
        elsif (defined $callbacks-&gt;{'ContentHandler'} 
        	and $callbacks-&gt;{'ContentHandler'}-&gt;can('AUTOLOAD')
        	and $callbacks-&gt;{'ContentHandler'}-&gt;can('AUTOLOAD') ne (UNIVERSAL-&gt;can('AUTOLOAD') || '')
        	)
        {
            my $res = eval { $callbacks-&gt;{'ContentHandler'}-&gt;set_document_locator(@_) };
            if ($@) {
                die $@;
            }
            else {
                # I think there's a buggette here...
                # if the first call throws an exception, we don't set it up right.
                # Not fatal, but we might want to address it.
                my $handler = $callbacks-&gt;{'ContentHandler'};
                $self-&gt;{Methods}-&gt;{'set_document_locator'} = sub { $handler-&gt;set_document_locator(@_) };
            }
            return $res;
        }
        elsif (defined $callbacks-&gt;{'DocumentHandler'} 
        	and $callbacks-&gt;{'DocumentHandler'}-&gt;can('AUTOLOAD')
        	and $callbacks-&gt;{'DocumentHandler'}-&gt;can('AUTOLOAD') ne (UNIVERSAL-&gt;can('AUTOLOAD') || '')
        	)
        {
            my $res = eval { $callbacks-&gt;{'DocumentHandler'}-&gt;set_document_locator(@_) };
            if ($@) {
                die $@;
            }
            else {
                # I think there's a buggette here...
                # if the first call throws an exception, we don't set it up right.
                # Not fatal, but we might want to address it.
                my $handler = $callbacks-&gt;{'DocumentHandler'};
                $self-&gt;{Methods}-&gt;{'set_document_locator'} = sub { $handler-&gt;set_document_locator(@_) };
            }
            return $res;
        }
        elsif (defined $callbacks-&gt;{'Handler'} 
        	and $callbacks-&gt;{'Handler'}-&gt;can('AUTOLOAD')
        	and $callbacks-&gt;{'Handler'}-&gt;can('AUTOLOAD') ne (UNIVERSAL-&gt;can('AUTOLOAD') || '')
        	)
        {
            my $res = eval { $callbacks-&gt;{'Handler'}-&gt;set_document_locator(@_) };
            if ($@) {
                die $@;
            }
            else {
                # I think there's a buggette here...
                # if the first call throws an exception, we don't set it up right.
                # Not fatal, but we might want to address it.
                my $handler = $callbacks-&gt;{'Handler'};
                $self-&gt;{Methods}-&gt;{'set_document_locator'} = sub { $handler-&gt;set_document_locator(@_) };
            }
            return $res;
        }
        else {
            $self-&gt;{Methods}-&gt;{'set_document_locator'} = sub { };
        }
    }

}

sub attlist_decl {
    my $self = shift;
    if (defined $self-&gt;{Methods}-&gt;{'attlist_decl'}) {
        $self-&gt;{Methods}-&gt;{'attlist_decl'}-&gt;(@_);
    }
    else {
        my $method;
        my $callbacks;
        if (exists $self-&gt;{ParseOptions}) {
            $callbacks = $self-&gt;{ParseOptions};
        }
        else {
            $callbacks = $self;
        }
        if (0) { # dummy to make elsif's below compile
        }
        elsif (defined $callbacks-&gt;{'DTDHandler'} and $method = $callbacks-&gt;{'DTDHandler'}-&gt;can('attlist_decl') ) {
            my $handler = $callbacks-&gt;{'DTDHandler'};
            $self-&gt;{Methods}-&gt;{'attlist_decl'} = sub { $method-&gt;($handler, @_) };
            return $method-&gt;($handler, @_);
        }
        elsif (defined $callbacks-&gt;{'Handler'} and $method = $callbacks-&gt;{'Handler'}-&gt;can('attlist_decl') ) {
            my $handler = $callbacks-&gt;{'Handler'};
            $self-&gt;{Methods}-&gt;{'attlist_decl'} = sub { $method-&gt;($handler, @_) };
            return $method-&gt;($handler, @_);
        }
        elsif (defined $callbacks-&gt;{'DTDHandler'} 
        	and $callbacks-&gt;{'DTDHandler'}-&gt;can('AUTOLOAD')
        	and $callbacks-&gt;{'DTDHandler'}-&gt;can('AUTOLOAD') ne (UNIVERSAL-&gt;can('AUTOLOAD') || '')
        	)
        {
            my $res = eval { $callbacks-&gt;{'DTDHandler'}-&gt;attlist_decl(@_) };
            if ($@) {
                die $@;
            }
            else {
                # I think there's a buggette here...
                # if the first call throws an exception, we don't set it up right.
                # Not fatal, but we might want to address it.
                my $handler = $callbacks-&gt;{'DTDHandler'};
                $self-&gt;{Methods}-&gt;{'attlist_decl'} = sub { $handler-&gt;attlist_decl(@_) };
            }
            return $res;
        }
        elsif (defined $callbacks-&gt;{'Handler'} 
        	and $callbacks-&gt;{'Handler'}-&gt;can('AUTOLOAD')
        	and $callbacks-&gt;{'Handler'}-&gt;can('AUTOLOAD') ne (UNIVERSAL-&gt;can('AUTOLOAD') || '')
        	)
        {
            my $res = eval { $callbacks-&gt;{'Handler'}-&gt;attlist_decl(@_) };
            if ($@) {
                die $@;
            }
            else {
                # I think there's a buggette here...
                # if the first call throws an exception, we don't set it up right.
                # Not fatal, but we might want to address it.
                my $handler = $callbacks-&gt;{'Handler'};
                $self-&gt;{Methods}-&gt;{'attlist_decl'} = sub { $handler-&gt;attlist_decl(@_) };
            }
            return $res;
        }
        else {
            $self-&gt;{Methods}-&gt;{'attlist_decl'} = sub { };
        }
    }

}

sub start_dtd {
    my $self = shift;
    if (defined $self-&gt;{Methods}-&gt;{'start_dtd'}) {
        $self-&gt;{Methods}-&gt;{'start_dtd'}-&gt;(@_);
    }
    else {
        my $method;
        my $callbacks;
        if (exists $self-&gt;{ParseOptions}) {
            $callbacks = $self-&gt;{ParseOptions};
        }
        else {
            $callbacks = $self;
        }
        if (0) { # dummy to make elsif's below compile
        }
        elsif (defined $callbacks-&gt;{'LexicalHandler'} and $method = $callbacks-&gt;{'LexicalHandler'}-&gt;can('start_dtd') ) {
            my $handler = $callbacks-&gt;{'LexicalHandler'};
            $self-&gt;{Methods}-&gt;{'start_dtd'} = sub { $method-&gt;($handler, @_) };
            return $method-&gt;($handler, @_);
        }
        elsif (defined $callbacks-&gt;{'Handler'} and $method = $callbacks-&gt;{'Handler'}-&gt;can('start_dtd') ) {
            my $handler = $callbacks-&gt;{'Handler'};
            $self-&gt;{Methods}-&gt;{'start_dtd'} = sub { $method-&gt;($handler, @_) };
            return $method-&gt;($handler, @_);
        }
        elsif (defined $callbacks-&gt;{'LexicalHandler'} 
        	and $callbacks-&gt;{'LexicalHandler'}-&gt;can('AUTOLOAD')
        	and $callbacks-&gt;{'LexicalHandler'}-&gt;can('AUTOLOAD') ne (UNIVERSAL-&gt;can('AUTOLOAD') || '')
        	)
        {
            my $res = eval { $callbacks-&gt;{'LexicalHandler'}-&gt;start_dtd(@_) };
            if ($@) {
                die $@;
            }
            else {
                # I think there's a buggette here...
                # if the first call throws an exception, we don't set it up right.
                # Not fatal, but we might want to address it.
                my $handler = $callbacks-&gt;{'LexicalHandler'};
                $self-&gt;{Methods}-&gt;{'start_dtd'} = sub { $handler-&gt;start_dtd(@_) };
            }
            return $res;
        }
        elsif (defined $callbacks-&gt;{'Handler'} 
        	and $callbacks-&gt;{'Handler'}-&gt;can('AUTOLOAD')
        	and $callbacks-&gt;{'Handler'}-&gt;can('AUTOLOAD') ne (UNIVERSAL-&gt;can('AUTOLOAD') || '')
        	)
        {
            my $res = eval { $callbacks-&gt;{'Handler'}-&gt;start_dtd(@_) };
            if ($@) {
                die $@;
            }
            else {
                # I think there's a buggette here...
                # if the first call throws an exception, we don't set it up right.
                # Not fatal, but we might want to address it.
                my $handler = $callbacks-&gt;{'Handler'};
                $self-&gt;{Methods}-&gt;{'start_dtd'} = sub { $handler-&gt;start_dtd(@_) };
            }
            return $res;
        }
        else {
            $self-&gt;{Methods}-&gt;{'start_dtd'} = sub { };
        }
    }

}

sub resolve_entity {
    my $self = shift;
    if (defined $self-&gt;{Methods}-&gt;{'resolve_entity'}) {
        $self-&gt;{Methods}-&gt;{'resolve_entity'}-&gt;(@_);
    }
    else {
        my $method;
        my $callbacks;
        if (exists $self-&gt;{ParseOptions}) {
            $callbacks = $self-&gt;{ParseOptions};
        }
        else {
            $callbacks = $self;
        }
        if (0) { # dummy to make elsif's below compile
        }
        elsif (defined $callbacks-&gt;{'EntityResolver'} and $method = $callbacks-&gt;{'EntityResolver'}-&gt;can('resolve_entity') ) {
            my $handler = $callbacks-&gt;{'EntityResolver'};
            $self-&gt;{Methods}-&gt;{'resolve_entity'} = sub { $method-&gt;($handler, @_) };
            return $method-&gt;($handler, @_);
        }
        elsif (defined $callbacks-&gt;{'Handler'} and $method = $callbacks-&gt;{'Handler'}-&gt;can('resolve_entity') ) {
            my $handler = $callbacks-&gt;{'Handler'};
            $self-&gt;{Methods}-&gt;{'resolve_entity'} = sub { $method-&gt;($handler, @_) };
            return $method-&gt;($handler, @_);
        }
        elsif (defined $callbacks-&gt;{'EntityResolver'} 
        	and $callbacks-&gt;{'EntityResolver'}-&gt;can('AUTOLOAD')
        	and $callbacks-&gt;{'EntityResolver'}-&gt;can('AUTOLOAD') ne (UNIVERSAL-&gt;can('AUTOLOAD') || '')
        	)
        {
            my $res = eval { $callbacks-&gt;{'EntityResolver'}-&gt;resolve_entity(@_) };
            if ($@) {
                die $@;
            }
            else {
                # I think there's a buggette here...
                # if the first call throws an exception, we don't set it up right.
                # Not fatal, but we might want to address it.
                my $handler = $callbacks-&gt;{'EntityResolver'};
                $self-&gt;{Methods}-&gt;{'resolve_entity'} = sub { $handler-&gt;resolve_entity(@_) };
            }
            return $res;
        }
        elsif (defined $callbacks-&gt;{'Handler'} 
        	and $callbacks-&gt;{'Handler'}-&gt;can('AUTOLOAD')
        	and $callbacks-&gt;{'Handler'}-&gt;can('AUTOLOAD') ne (UNIVERSAL-&gt;can('AUTOLOAD') || '')
        	)
        {
            my $res = eval { $callbacks-&gt;{'Handler'}-&gt;resolve_entity(@_) };
            if ($@) {
                die $@;
            }
            else {
                # I think there's a buggette here...
                # if the first call throws an exception, we don't set it up right.
                # Not fatal, but we might want to address it.
                my $handler = $callbacks-&gt;{'Handler'};
                $self-&gt;{Methods}-&gt;{'resolve_entity'} = sub { $handler-&gt;resolve_entity(@_) };
            }
            return $res;
        }
        else {
            $self-&gt;{Methods}-&gt;{'resolve_entity'} = sub { };
        }
    }

}

sub entity_reference {
    my $self = shift;
    if (defined $self-&gt;{Methods}-&gt;{'entity_reference'}) {
        $self-&gt;{Methods}-&gt;{'entity_reference'}-&gt;(@_);
    }
    else {
        my $method;
        my $callbacks;
        if (exists $self-&gt;{ParseOptions}) {
            $callbacks = $self-&gt;{ParseOptions};
        }
        else {
            $callbacks = $self;
        }
        if (0) { # dummy to make elsif's below compile
        }
        elsif (defined $callbacks-&gt;{'DocumentHandler'} and $method = $callbacks-&gt;{'DocumentHandler'}-&gt;can('entity_reference') ) {
            my $handler = $callbacks-&gt;{'DocumentHandler'};
            $self-&gt;{Methods}-&gt;{'entity_reference'} = sub { $method-&gt;($handler, @_) };
            return $method-&gt;($handler, @_);
        }
        elsif (defined $callbacks-&gt;{'Handler'} and $method = $callbacks-&gt;{'Handler'}-&gt;can('entity_reference') ) {
            my $handler = $callbacks-&gt;{'Handler'};
            $self-&gt;{Methods}-&gt;{'entity_reference'} = sub { $method-&gt;($handler, @_) };
            return $method-&gt;($handler, @_);
        }
        elsif (defined $callbacks-&gt;{'DocumentHandler'} 
        	and $callbacks-&gt;{'DocumentHandler'}-&gt;can('AUTOLOAD')
        	and $callbacks-&gt;{'DocumentHandler'}-&gt;can('AUTOLOAD') ne (UNIVERSAL-&gt;can('AUTOLOAD') || '')
        	)
        {
            my $res = eval { $callbacks-&gt;{'DocumentHandler'}-&gt;entity_reference(@_) };
            if ($@) {
                die $@;
            }
            else {
                # I think there's a buggette here...
                # if the first call throws an exception, we don't set it up right.
                # Not fatal, but we might want to address it.
                my $handler = $callbacks-&gt;{'DocumentHandler'};
                $self-&gt;{Methods}-&gt;{'entity_reference'} = sub { $handler-&gt;entity_reference(@_) };
            }
            return $res;
        }
        elsif (defined $callbacks-&gt;{'Handler'} 
        	and $callbacks-&gt;{'Handler'}-&gt;can('AUTOLOAD')
        	and $callbacks-&gt;{'Handler'}-&gt;can('AUTOLOAD') ne (UNIVERSAL-&gt;can('AUTOLOAD') || '')
        	)
        {
            my $res = eval { $callbacks-&gt;{'Handler'}-&gt;entity_reference(@_) };
            if ($@) {
                die $@;
            }
            else {
                # I think there's a buggette here...
                # if the first call throws an exception, we don't set it up right.
                # Not fatal, but we might want to address it.
                my $handler = $callbacks-&gt;{'Handler'};
                $self-&gt;{Methods}-&gt;{'entity_reference'} = sub { $handler-&gt;entity_reference(@_) };
            }
            return $res;
        }
        else {
            $self-&gt;{Methods}-&gt;{'entity_reference'} = sub { };
        }
    }

}

sub element_decl {
    my $self = shift;
    if (defined $self-&gt;{Methods}-&gt;{'element_decl'}) {
        $self-&gt;{Methods}-&gt;{'element_decl'}-&gt;(@_);
    }
    else {
        my $method;
        my $callbacks;
        if (exists $self-&gt;{ParseOptions}) {
            $callbacks = $self-&gt;{ParseOptions};
        }
        else {
            $callbacks = $self;
        }
        if (0) { # dummy to make elsif's below compile
        }
        elsif (defined $callbacks-&gt;{'DeclHandler'} and $method = $callbacks-&gt;{'DeclHandler'}-&gt;can('element_decl') ) {
            my $handler = $callbacks-&gt;{'DeclHandler'};
            $self-&gt;{Methods}-&gt;{'element_decl'} = sub { $method-&gt;($handler, @_) };
            return $method-&gt;($handler, @_);
        }
        elsif (defined $callbacks-&gt;{'Handler'} and $method = $callbacks-&gt;{'Handler'}-&gt;can('element_decl') ) {
            my $handler = $callbacks-&gt;{'Handler'};
            $self-&gt;{Methods}-&gt;{'element_decl'} = sub { $method-&gt;($handler, @_) };
            return $method-&gt;($handler, @_);
        }
        elsif (defined $callbacks-&gt;{'DeclHandler'} 
        	and $callbacks-&gt;{'DeclHandler'}-&gt;can('AUTOLOAD')
        	and $callbacks-&gt;{'DeclHandler'}-&gt;can('AUTOLOAD') ne (UNIVERSAL-&gt;can('AUTOLOAD') || '')
        	)
        {
            my $res = eval { $callbacks-&gt;{'DeclHandler'}-&gt;element_decl(@_) };
            if ($@) {
                die $@;
            }
            else {
                # I think there's a buggette here...
                # if the first call throws an exception, we don't set it up right.
                # Not fatal, but we might want to address it.
                my $handler = $callbacks-&gt;{'DeclHandler'};
                $self-&gt;{Methods}-&gt;{'element_decl'} = sub { $handler-&gt;element_decl(@_) };
            }
            return $res;
        }
        elsif (defined $callbacks-&gt;{'Handler'} 
        	and $callbacks-&gt;{'Handler'}-&gt;can('AUTOLOAD')
        	and $callbacks-&gt;{'Handler'}-&gt;can('AUTOLOAD') ne (UNIVERSAL-&gt;can('AUTOLOAD') || '')
        	)
        {
            my $res = eval { $callbacks-&gt;{'Handler'}-&gt;element_decl(@_) };
            if ($@) {
                die $@;
            }
            else {
                # I think there's a buggette here...
                # if the first call throws an exception, we don't set it up right.
                # Not fatal, but we might want to address it.
                my $handler = $callbacks-&gt;{'Handler'};
                $self-&gt;{Methods}-&gt;{'element_decl'} = sub { $handler-&gt;element_decl(@_) };
            }
            return $res;
        }
        else {
            $self-&gt;{Methods}-&gt;{'element_decl'} = sub { };
        }
    }

}

sub notation_decl {
    my $self = shift;
    if (defined $self-&gt;{Methods}-&gt;{'notation_decl'}) {
        $self-&gt;{Methods}-&gt;{'notation_decl'}-&gt;(@_);
    }
    else {
        my $method;
        my $callbacks;
        if (exists $self-&gt;{ParseOptions}) {
            $callbacks = $self-&gt;{ParseOptions};
        }
        else {
            $callbacks = $self;
        }
        if (0) { # dummy to make elsif's below compile
        }
        elsif (defined $callbacks-&gt;{'DTDHandler'} and $method = $callbacks-&gt;{'DTDHandler'}-&gt;can('notation_decl') ) {
            my $handler = $callbacks-&gt;{'DTDHandler'};
            $self-&gt;{Methods}-&gt;{'notation_decl'} = sub { $method-&gt;($handler, @_) };
            return $method-&gt;($handler, @_);
        }
        elsif (defined $callbacks-&gt;{'Handler'} and $method = $callbacks-&gt;{'Handler'}-&gt;can('notation_decl') ) {
            my $handler = $callbacks-&gt;{'Handler'};
            $self-&gt;{Methods}-&gt;{'notation_decl'} = sub { $method-&gt;($handler, @_) };
            return $method-&gt;($handler, @_);
        }
        elsif (defined $callbacks-&gt;{'DTDHandler'} 
        	and $callbacks-&gt;{'DTDHandler'}-&gt;can('AUTOLOAD')
        	and $callbacks-&gt;{'DTDHandler'}-&gt;can('AUTOLOAD') ne (UNIVERSAL-&gt;can('AUTOLOAD') || '')
        	)
        {
            my $res = eval { $callbacks-&gt;{'DTDHandler'}-&gt;notation_decl(@_) };
            if ($@) {
                die $@;
            }
            else {
                # I think there's a buggette here...
                # if the first call throws an exception, we don't set it up right.
                # Not fatal, but we might want to address it.
                my $handler = $callbacks-&gt;{'DTDHandler'};
                $self-&gt;{Methods}-&gt;{'notation_decl'} = sub { $handler-&gt;notation_decl(@_) };
            }
            return $res;
        }
        elsif (defined $callbacks-&gt;{'Handler'} 
        	and $callbacks-&gt;{'Handler'}-&gt;can('AUTOLOAD')
        	and $callbacks-&gt;{'Handler'}-&gt;can('AUTOLOAD') ne (UNIVERSAL-&gt;can('AUTOLOAD') || '')
        	)
        {
            my $res = eval { $callbacks-&gt;{'Handler'}-&gt;notation_decl(@_) };
            if ($@) {
                die $@;
            }
            else {
                # I think there's a buggette here...
                # if the first call throws an exception, we don't set it up right.
                # Not fatal, but we might want to address it.
                my $handler = $callbacks-&gt;{'Handler'};
                $self-&gt;{Methods}-&gt;{'notation_decl'} = sub { $handler-&gt;notation_decl(@_) };
            }
            return $res;
        }
        else {
            $self-&gt;{Methods}-&gt;{'notation_decl'} = sub { };
        }
    }

}

sub skipped_entity {
    my $self = shift;
    if (defined $self-&gt;{Methods}-&gt;{'skipped_entity'}) {
        $self-&gt;{Methods}-&gt;{'skipped_entity'}-&gt;(@_);
    }
    else {
        my $method;
        my $callbacks;
        if (exists $self-&gt;{ParseOptions}) {
            $callbacks = $self-&gt;{ParseOptions};
        }
        else {
            $callbacks = $self;
        }
        if (0) { # dummy to make elsif's below compile
        }
        elsif (defined $callbacks-&gt;{'ContentHandler'} and $method = $callbacks-&gt;{'ContentHandler'}-&gt;can('skipped_entity') ) {
            my $handler = $callbacks-&gt;{'ContentHandler'};
            $self-&gt;{Methods}-&gt;{'skipped_entity'} = sub { $method-&gt;($handler, @_) };
            return $method-&gt;($handler, @_);
        }
        elsif (defined $callbacks-&gt;{'Handler'} and $method = $callbacks-&gt;{'Handler'}-&gt;can('skipped_entity') ) {
            my $handler = $callbacks-&gt;{'Handler'};
            $self-&gt;{Methods}-&gt;{'skipped_entity'} = sub { $method-&gt;($handler, @_) };
            return $method-&gt;($handler, @_);
        }
        elsif (defined $callbacks-&gt;{'ContentHandler'} 
        	and $callbacks-&gt;{'ContentHandler'}-&gt;can('AUTOLOAD')
        	and $callbacks-&gt;{'ContentHandler'}-&gt;can('AUTOLOAD') ne (UNIVERSAL-&gt;can('AUTOLOAD') || '')
        	)
        {
            my $res = eval { $callbacks-&gt;{'ContentHandler'}-&gt;skipped_entity(@_) };
            if ($@) {
                die $@;
            }
            else {
                # I think there's a buggette here...
                # if the first call throws an exception, we don't set it up right.
                # Not fatal, but we might want to address it.
                my $handler = $callbacks-&gt;{'ContentHandler'};
                $self-&gt;{Methods}-&gt;{'skipped_entity'} = sub { $handler-&gt;skipped_entity(@_) };
            }
            return $res;
        }
        elsif (defined $callbacks-&gt;{'Handler'} 
        	and $callbacks-&gt;{'Handler'}-&gt;can('AUTOLOAD')
        	and $callbacks-&gt;{'Handler'}-&gt;can('AUTOLOAD') ne (UNIVERSAL-&gt;can('AUTOLOAD') || '')
        	)
        {
            my $res = eval { $callbacks-&gt;{'Handler'}-&gt;skipped_entity(@_) };
            if ($@) {
                die $@;
            }
            else {
                # I think there's a buggette here...
                # if the first call throws an exception, we don't set it up right.
                # Not fatal, but we might want to address it.
                my $handler = $callbacks-&gt;{'Handler'};
                $self-&gt;{Methods}-&gt;{'skipped_entity'} = sub { $handler-&gt;skipped_entity(@_) };
            }
            return $res;
        }
        else {
            $self-&gt;{Methods}-&gt;{'skipped_entity'} = sub { };
        }
    }

}

sub end_element {
    my $self = shift;
    if (defined $self-&gt;{Methods}-&gt;{'end_element'}) {
        $self-&gt;{Methods}-&gt;{'end_element'}-&gt;(@_);
    }
    else {
        my $method;
        my $callbacks;
        if (exists $self-&gt;{ParseOptions}) {
            $callbacks = $self-&gt;{ParseOptions};
        }
        else {
            $callbacks = $self;
        }
        if (0) { # dummy to make elsif's below compile
        }
        elsif (defined $callbacks-&gt;{'ContentHandler'} and $method = $callbacks-&gt;{'ContentHandler'}-&gt;can('end_element') ) {
            my $handler = $callbacks-&gt;{'ContentHandler'};
            $self-&gt;{Methods}-&gt;{'end_element'} = sub { $method-&gt;($handler, @_) };
            return $method-&gt;($handler, @_);
        }
        elsif (defined $callbacks-&gt;{'DocumentHandler'} and $method = $callbacks-&gt;{'DocumentHandler'}-&gt;can('end_element') ) {
            my $handler = $callbacks-&gt;{'DocumentHandler'};
            $self-&gt;{Methods}-&gt;{'end_element'} = sub { $method-&gt;($handler, @_) };
            return $method-&gt;($handler, @_);
        }
        elsif (defined $callbacks-&gt;{'Handler'} and $method = $callbacks-&gt;{'Handler'}-&gt;can('end_element') ) {
            my $handler = $callbacks-&gt;{'Handler'};
            $self-&gt;{Methods}-&gt;{'end_element'} = sub { $method-&gt;($handler, @_) };
            return $method-&gt;($handler, @_);
        }
        elsif (defined $callbacks-&gt;{'ContentHandler'} 
        	and $callbacks-&gt;{'ContentHandler'}-&gt;can('AUTOLOAD')
        	and $callbacks-&gt;{'ContentHandler'}-&gt;can('AUTOLOAD') ne (UNIVERSAL-&gt;can('AUTOLOAD') || '')
        	)
        {
            my $res = eval { $callbacks-&gt;{'ContentHandler'}-&gt;end_element(@_) };
            if ($@) {
                die $@;
            }
            else {
                # I think there's a buggette here...
                # if the first call throws an exception, we don't set it up right.
                # Not fatal, but we might want to address it.
                my $handler = $callbacks-&gt;{'ContentHandler'};
                $self-&gt;{Methods}-&gt;{'end_element'} = sub { $handler-&gt;end_element(@_) };
            }
            return $res;
        }
        elsif (defined $callbacks-&gt;{'DocumentHandler'} 
        	and $callbacks-&gt;{'DocumentHandler'}-&gt;can('AUTOLOAD')
        	and $callbacks-&gt;{'DocumentHandler'}-&gt;can('AUTOLOAD') ne (UNIVERSAL-&gt;can('AUTOLOAD') || '')
        	)
        {
            my $res = eval { $callbacks-&gt;{'DocumentHandler'}-&gt;end_element(@_) };
            if ($@) {
                die $@;
            }
            else {
                # I think there's a buggette here...
                # if the first call throws an exception, we don't set it up right.
                # Not fatal, but we might want to address it.
                my $handler = $callbacks-&gt;{'DocumentHandler'};
                $self-&gt;{Methods}-&gt;{'end_element'} = sub { $handler-&gt;end_element(@_) };
            }
            return $res;
        }
        elsif (defined $callbacks-&gt;{'Handler'} 
        	and $callbacks-&gt;{'Handler'}-&gt;can('AUTOLOAD')
        	and $callbacks-&gt;{'Handler'}-&gt;can('AUTOLOAD') ne (UNIVERSAL-&gt;can('AUTOLOAD') || '')
        	)
        {
            my $res = eval { $callbacks-&gt;{'Handler'}-&gt;end_element(@_) };
            if ($@) {
                die $@;
            }
            else {
                # I think there's a buggette here...
                # if the first call throws an exception, we don't set it up right.
                # Not fatal, but we might want to address it.
                my $handler = $callbacks-&gt;{'Handler'};
                $self-&gt;{Methods}-&gt;{'end_element'} = sub { $handler-&gt;end_element(@_) };
            }
            return $res;
        }
        else {
            $self-&gt;{Methods}-&gt;{'end_element'} = sub { };
        }
    }

}

sub doctype_decl {
    my $self = shift;
    if (defined $self-&gt;{Methods}-&gt;{'doctype_decl'}) {
        $self-&gt;{Methods}-&gt;{'doctype_decl'}-&gt;(@_);
    }
    else {
        my $method;
        my $callbacks;
        if (exists $self-&gt;{ParseOptions}) {
            $callbacks = $self-&gt;{ParseOptions};
        }
        else {
            $callbacks = $self;
        }
        if (0) { # dummy to make elsif's below compile
        }
        elsif (defined $callbacks-&gt;{'DTDHandler'} and $method = $callbacks-&gt;{'DTDHandler'}-&gt;can('doctype_decl') ) {
            my $handler = $callbacks-&gt;{'DTDHandler'};
            $self-&gt;{Methods}-&gt;{'doctype_decl'} = sub { $method-&gt;($handler, @_) };
            return $method-&gt;($handler, @_);
        }
        elsif (defined $callbacks-&gt;{'Handler'} and $method = $callbacks-&gt;{'Handler'}-&gt;can('doctype_decl') ) {
            my $handler = $callbacks-&gt;{'Handler'};
            $self-&gt;{Methods}-&gt;{'doctype_decl'} = sub { $method-&gt;($handler, @_) };
            return $method-&gt;($handler, @_);
        }
        elsif (defined $callbacks-&gt;{'DTDHandler'} 
        	and $callbacks-&gt;{'DTDHandler'}-&gt;can('AUTOLOAD')
        	and $callbacks-&gt;{'DTDHandler'}-&gt;can('AUTOLOAD') ne (UNIVERSAL-&gt;can('AUTOLOAD') || '')
        	)
        {
            my $res = eval { $callbacks-&gt;{'DTDHandler'}-&gt;doctype_decl(@_) };
            if ($@) {
                die $@;
            }
            else {
                # I think there's a buggette here...
                # if the first call throws an exception, we don't set it up right.
                # Not fatal, but we might want to address it.
                my $handler = $callbacks-&gt;{'DTDHandler'};
                $self-&gt;{Methods}-&gt;{'doctype_decl'} = sub { $handler-&gt;doctype_decl(@_) };
            }
            return $res;
        }
        elsif (defined $callbacks-&gt;{'Handler'} 
        	and $callbacks-&gt;{'Handler'}-&gt;can('AUTOLOAD')
        	and $callbacks-&gt;{'Handler'}-&gt;can('AUTOLOAD') ne (UNIVERSAL-&gt;can('AUTOLOAD') || '')
        	)
        {
            my $res = eval { $callbacks-&gt;{'Handler'}-&gt;doctype_decl(@_) };
            if ($@) {
                die $@;
            }
            else {
                # I think there's a buggette here...
                # if the first call throws an exception, we don't set it up right.
                # Not fatal, but we might want to address it.
                my $handler = $callbacks-&gt;{'Handler'};
                $self-&gt;{Methods}-&gt;{'doctype_decl'} = sub { $handler-&gt;doctype_decl(@_) };
            }
            return $res;
        }
        else {
            $self-&gt;{Methods}-&gt;{'doctype_decl'} = sub { };
        }
    }

}

sub comment {
    my $self = shift;
    if (defined $self-&gt;{Methods}-&gt;{'comment'}) {
        $self-&gt;{Methods}-&gt;{'comment'}-&gt;(@_);
    }
    else {
        my $method;
        my $callbacks;
        if (exists $self-&gt;{ParseOptions}) {
            $callbacks = $self-&gt;{ParseOptions};
        }
        else {
            $callbacks = $self;
        }
        if (0) { # dummy to make elsif's below compile
        }
        elsif (defined $callbacks-&gt;{'DocumentHandler'} and $method = $callbacks-&gt;{'DocumentHandler'}-&gt;can('comment') ) {
            my $handler = $callbacks-&gt;{'DocumentHandler'};
            $self-&gt;{Methods}-&gt;{'comment'} = sub { $method-&gt;($handler, @_) };
            return $method-&gt;($handler, @_);
        }
        elsif (defined $callbacks-&gt;{'LexicalHandler'} and $method = $callbacks-&gt;{'LexicalHandler'}-&gt;can('comment') ) {
            my $handler = $callbacks-&gt;{'LexicalHandler'};
            $self-&gt;{Methods}-&gt;{'comment'} = sub { $method-&gt;($handler, @_) };
            return $method-&gt;($handler, @_);
        }
        elsif (defined $callbacks-&gt;{'Handler'} and $method = $callbacks-&gt;{'Handler'}-&gt;can('comment') ) {
            my $handler = $callbacks-&gt;{'Handler'};
            $self-&gt;{Methods}-&gt;{'comment'} = sub { $method-&gt;($handler, @_) };
            return $method-&gt;($handler, @_);
        }
        elsif (defined $callbacks-&gt;{'DocumentHandler'} 
        	and $callbacks-&gt;{'DocumentHandler'}-&gt;can('AUTOLOAD')
        	and $callbacks-&gt;{'DocumentHandler'}-&gt;can('AUTOLOAD') ne (UNIVERSAL-&gt;can('AUTOLOAD') || '')
        	)
        {
            my $res = eval { $callbacks-&gt;{'DocumentHandler'}-&gt;comment(@_) };
            if ($@) {
                die $@;
            }
            else {
                # I think there's a buggette here...
                # if the first call throws an exception, we don't set it up right.
                # Not fatal, but we might want to address it.
                my $handler = $callbacks-&gt;{'DocumentHandler'};
                $self-&gt;{Methods}-&gt;{'comment'} = sub { $handler-&gt;comment(@_) };
            }
            return $res;
        }
        elsif (defined $callbacks-&gt;{'LexicalHandler'} 
        	and $callbacks-&gt;{'LexicalHandler'}-&gt;can('AUTOLOAD')
        	and $callbacks-&gt;{'LexicalHandler'}-&gt;can('AUTOLOAD') ne (UNIVERSAL-&gt;can('AUTOLOAD') || '')
        	)
        {
            my $res = eval { $callbacks-&gt;{'LexicalHandler'}-&gt;comment(@_) };
            if ($@) {
                die $@;
            }
            else {
                # I think there's a buggette here...
                # if the first call throws an exception, we don't set it up right.
                # Not fatal, but we might want to address it.
                my $handler = $callbacks-&gt;{'LexicalHandler'};
                $self-&gt;{Methods}-&gt;{'comment'} = sub { $handler-&gt;comment(@_) };
            }
            return $res;
        }
        elsif (defined $callbacks-&gt;{'Handler'} 
        	and $callbacks-&gt;{'Handler'}-&gt;can('AUTOLOAD')
        	and $callbacks-&gt;{'Handler'}-&gt;can('AUTOLOAD') ne (UNIVERSAL-&gt;can('AUTOLOAD') || '')
        	)
        {
            my $res = eval { $callbacks-&gt;{'Handler'}-&gt;comment(@_) };
            if ($@) {
                die $@;
            }
            else {
                # I think there's a buggette here...
                # if the first call throws an exception, we don't set it up right.
                # Not fatal, but we might want to address it.
                my $handler = $callbacks-&gt;{'Handler'};
                $self-&gt;{Methods}-&gt;{'comment'} = sub { $handler-&gt;comment(@_) };
            }
            return $res;
        }
        else {
            $self-&gt;{Methods}-&gt;{'comment'} = sub { };
        }
    }

}

sub end_entity {
    my $self = shift;
    if (defined $self-&gt;{Methods}-&gt;{'end_entity'}) {
        $self-&gt;{Methods}-&gt;{'end_entity'}-&gt;(@_);
    }
    else {
        my $method;
        my $callbacks;
        if (exists $self-&gt;{ParseOptions}) {
            $callbacks = $self-&gt;{ParseOptions};
        }
        else {
            $callbacks = $self;
        }
        if (0) { # dummy to make elsif's below compile
        }
        elsif (defined $callbacks-&gt;{'LexicalHandler'} and $method = $callbacks-&gt;{'LexicalHandler'}-&gt;can('end_entity') ) {
            my $handler = $callbacks-&gt;{'LexicalHandler'};
            $self-&gt;{Methods}-&gt;{'end_entity'} = sub { $method-&gt;($handler, @_) };
            return $method-&gt;($handler, @_);
        }
        elsif (defined $callbacks-&gt;{'Handler'} and $method = $callbacks-&gt;{'Handler'}-&gt;can('end_entity') ) {
            my $handler = $callbacks-&gt;{'Handler'};
            $self-&gt;{Methods}-&gt;{'end_entity'} = sub { $method-&gt;($handler, @_) };
            return $method-&gt;($handler, @_);
        }
        elsif (defined $callbacks-&gt;{'LexicalHandler'} 
        	and $callbacks-&gt;{'LexicalHandler'}-&gt;can('AUTOLOAD')
        	and $callbacks-&gt;{'LexicalHandler'}-&gt;can('AUTOLOAD') ne (UNIVERSAL-&gt;can('AUTOLOAD') || '')
        	)
        {
            my $res = eval { $callbacks-&gt;{'LexicalHandler'}-&gt;end_entity(@_) };
            if ($@) {
                die $@;
            }
            else {
                # I think there's a buggette here...
                # if the first call throws an exception, we don't set it up right.
                # Not fatal, but we might want to address it.
                my $handler = $callbacks-&gt;{'LexicalHandler'};
                $self-&gt;{Methods}-&gt;{'end_entity'} = sub { $handler-&gt;end_entity(@_) };
            }
            return $res;
        }
        elsif (defined $callbacks-&gt;{'Handler'} 
        	and $callbacks-&gt;{'Handler'}-&gt;can('AUTOLOAD')
        	and $callbacks-&gt;{'Handler'}-&gt;can('AUTOLOAD') ne (UNIVERSAL-&gt;can('AUTOLOAD') || '')
        	)
        {
            my $res = eval { $callbacks-&gt;{'Handler'}-&gt;end_entity(@_) };
            if ($@) {
                die $@;
            }
            else {
                # I think there's a buggette here...
                # if the first call throws an exception, we don't set it up right.
                # Not fatal, but we might want to address it.
                my $handler = $callbacks-&gt;{'Handler'};
                $self-&gt;{Methods}-&gt;{'end_entity'} = sub { $handler-&gt;end_entity(@_) };
            }
            return $res;
        }
        else {
            $self-&gt;{Methods}-&gt;{'end_entity'} = sub { };
        }
    }

}

sub warning {
    my $self = shift;
    if (defined $self-&gt;{Methods}-&gt;{'warning'}) {
        $self-&gt;{Methods}-&gt;{'warning'}-&gt;(@_);
    }
    else {
        my $method;
        my $callbacks;
        if (exists $self-&gt;{ParseOptions}) {
            $callbacks = $self-&gt;{ParseOptions};
        }
        else {
            $callbacks = $self;
        }
        if (0) { # dummy to make elsif's below compile
        }
        elsif (defined $callbacks-&gt;{'ErrorHandler'} and $method = $callbacks-&gt;{'ErrorHandler'}-&gt;can('warning') ) {
            my $handler = $callbacks-&gt;{'ErrorHandler'};
            $self-&gt;{Methods}-&gt;{'warning'} = sub { $method-&gt;($handler, @_) };
            return $method-&gt;($handler, @_);
        }
        elsif (defined $callbacks-&gt;{'Handler'} and $method = $callbacks-&gt;{'Handler'}-&gt;can('warning') ) {
            my $handler = $callbacks-&gt;{'Handler'};
            $self-&gt;{Methods}-&gt;{'warning'} = sub { $method-&gt;($handler, @_) };
            return $method-&gt;($handler, @_);
        }
        elsif (defined $callbacks-&gt;{'ErrorHandler'} 
        	and $callbacks-&gt;{'ErrorHandler'}-&gt;can('AUTOLOAD')
        	and $callbacks-&gt;{'ErrorHandler'}-&gt;can('AUTOLOAD') ne (UNIVERSAL-&gt;can('AUTOLOAD') || '')
        	)
        {
            my $res = eval { $callbacks-&gt;{'ErrorHandler'}-&gt;warning(@_) };
            if ($@) {
                die $@;
            }
            else {
                # I think there's a buggette here...
                # if the first call throws an exception, we don't set it up right.
                # Not fatal, but we might want to address it.
                my $handler = $callbacks-&gt;{'ErrorHandler'};
                $self-&gt;{Methods}-&gt;{'warning'} = sub { $handler-&gt;warning(@_) };
            }
            return $res;
        }
        elsif (defined $callbacks-&gt;{'Handler'} 
        	and $callbacks-&gt;{'Handler'}-&gt;can('AUTOLOAD')
        	and $callbacks-&gt;{'Handler'}-&gt;can('AUTOLOAD') ne (UNIVERSAL-&gt;can('AUTOLOAD') || '')
        	)
        {
            my $res = eval { $callbacks-&gt;{'Handler'}-&gt;warning(@_) };
            if ($@) {
                die $@;
            }
            else {
                # I think there's a buggette here...
                # if the first call throws an exception, we don't set it up right.
                # Not fatal, but we might want to address it.
                my $handler = $callbacks-&gt;{'Handler'};
                $self-&gt;{Methods}-&gt;{'warning'} = sub { $handler-&gt;warning(@_) };
            }
            return $res;
        }
        else {
            $self-&gt;{Methods}-&gt;{'warning'} = sub { };
        }
    }

}

#-------------------------------------------------------------------#
# Class-&gt;new(%options)
#-------------------------------------------------------------------#
sub new {
    my $proto = shift;
    my $class = ref($proto) || $proto;
    my $options = ($#_ == 0) ? shift : { @_ };

    unless ( defined( $options-&gt;{Handler} )         or
             defined( $options-&gt;{ContentHandler} )  or
             defined( $options-&gt;{DTDHandler} )      or
             defined( $options-&gt;{DocumentHandler} ) or
             defined( $options-&gt;{LexicalHandler} )  or
             defined( $options-&gt;{ErrorHandler} )    or
             defined( $options-&gt;{DeclHandler} ) ) {
            
             $options-&gt;{Handler} = XML::SAX::Base::NoHandler-&gt;new;
    }

    my $self = bless $options, $class;
    # turn NS processing on by default
    $self-&gt;set_feature('http://xml.org/sax/features/namespaces', 1);
    return $self;
}
#-------------------------------------------------------------------#

#-------------------------------------------------------------------#
# $p-&gt;parse(%options)
#-------------------------------------------------------------------#
sub parse {
    my $self = shift;
    my $parse_options = $self-&gt;get_options(@_);
    local $self-&gt;{ParseOptions} = $parse_options;
    if ($self-&gt;{Parent}) { # calling parse on a filter for some reason
        return $self-&gt;{Parent}-&gt;parse($parse_options);
    }
    else {
        my $method;
        if (defined $parse_options-&gt;{Source}{CharacterStream} and $method = $self-&gt;can('_parse_characterstream')) {
            warn("parse charstream???\n");
            return $method-&gt;($self, $parse_options-&gt;{Source}{CharacterStream});
        }
        elsif (defined $parse_options-&gt;{Source}{ByteStream} and $method = $self-&gt;can('_parse_bytestream')) {
            return $method-&gt;($self, $parse_options-&gt;{Source}{ByteStream});
        }
        elsif (defined $parse_options-&gt;{Source}{String} and $method = $self-&gt;can('_parse_string')) {
            return $method-&gt;($self, $parse_options-&gt;{Source}{String});
        }
        elsif (defined $parse_options-&gt;{Source}{SystemId} and $method = $self-&gt;can('_parse_systemid')) {
            return $method-&gt;($self, $parse_options-&gt;{Source}{SystemId});
        }
        else {
            die "No _parse_* routine defined on this driver (If it is a filter, remember to set the Parent property. If you call the parse() method, make sure to set a Source. You may want to call parse_uri, parse_string or parse_file instead.) [$self]";
        }
    }
}
#-------------------------------------------------------------------#

#-------------------------------------------------------------------#
# $p-&gt;parse_file(%options)
#-------------------------------------------------------------------#
sub parse_file {
    my $self = shift;
    my $file = shift;
    return $self-&gt;parse_uri($file, @_) if ref(\$file) eq 'SCALAR';
    my $parse_options = $self-&gt;get_options(@_);
    $parse_options-&gt;{Source}{ByteStream} = $file;
    return $self-&gt;parse($parse_options);
}
#-------------------------------------------------------------------#

#-------------------------------------------------------------------#
# $p-&gt;parse_uri(%options)
#-------------------------------------------------------------------#
sub parse_uri {
    my $self = shift;
    my $file = shift;
    my $parse_options = $self-&gt;get_options(@_);
    $parse_options-&gt;{Source}{SystemId} = $file;
    return $self-&gt;parse($parse_options);
}
#-------------------------------------------------------------------#

#-------------------------------------------------------------------#
# $p-&gt;parse_string(%options)
#-------------------------------------------------------------------#
sub parse_string {
    my $self = shift;
    my $string = shift;
    my $parse_options = $self-&gt;get_options(@_);
    $parse_options-&gt;{Source}{String} = $string;
    return $self-&gt;parse($parse_options);
}
#-------------------------------------------------------------------#

#-------------------------------------------------------------------#
# get_options
#-------------------------------------------------------------------#
sub get_options {
    my $self = shift;

    if (@_ == 1) {
        return { %$self, %{$_[0]} };
    } else {
        return { %$self, @_ };
    }
}
#-------------------------------------------------------------------#

#-------------------------------------------------------------------#
# get_features
#-------------------------------------------------------------------#
sub get_features {
   return (
    'http://xml.org/sax/features/external-general-entities'     =&gt; undef,
    'http://xml.org/sax/features/external-parameter-entities'   =&gt; undef,
    'http://xml.org/sax/features/is-standalone'                 =&gt; undef,
    'http://xml.org/sax/features/lexical-handler'               =&gt; undef,
    'http://xml.org/sax/features/parameter-entities'            =&gt; undef,
    'http://xml.org/sax/features/namespaces'                    =&gt; 1,
    'http://xml.org/sax/features/namespace-prefixes'            =&gt; 0,
    'http://xml.org/sax/features/string-interning'              =&gt; undef,
    'http://xml.org/sax/features/use-attributes2'               =&gt; undef,
    'http://xml.org/sax/features/use-locator2'                  =&gt; undef,
    'http://xml.org/sax/features/validation'                    =&gt; undef,

    'http://xml.org/sax/properties/dom-node'                    =&gt; undef,
    'http://xml.org/sax/properties/xml-string'                  =&gt; undef,
               );
}
#-------------------------------------------------------------------#

#-------------------------------------------------------------------#
# get_feature
#-------------------------------------------------------------------#
sub get_feature {
    my $self = shift;
    my $feat = shift;

    # check %FEATURES to see if it's there, and return it if so
    # throw XML::SAX::Exception::NotRecognized if it's not there
    # throw XML::SAX::Exception::NotSupported if it's there but we
    # don't support it
    
    my %features = $self-&gt;get_features();
    if (exists $features{$feat}) {
        my %supported = map { $_ =&gt; 1 } $self-&gt;supported_features();
        if ($supported{$feat}) {
            return $self-&gt;{__PACKAGE__ . "::Features"}{$feat};
        }
        throw XML::SAX::Exception::NotSupported(
            Message =&gt; "The feature '$feat' is not supported by " . ref($self),
            Exception =&gt; undef,
            );
    }
    throw XML::SAX::Exception::NotRecognized(
        Message =&gt; "The feature '$feat' is not recognized by " . ref($self),
        Exception =&gt; undef,
        );
}
#-------------------------------------------------------------------#

#-------------------------------------------------------------------#
# set_feature
#-------------------------------------------------------------------#
sub set_feature {
    my $self = shift;
    my $feat = shift;
    my $value = shift;
    # check %FEATURES to see if it's there, and set it if so
    # throw XML::SAX::Exception::NotRecognized if it's not there
    # throw XML::SAX::Exception::NotSupported if it's there but we
    # don't support it
    
    my %features = $self-&gt;get_features();
    if (exists $features{$feat}) {
        my %supported = map { $_ =&gt; 1 } $self-&gt;supported_features();
        if ($supported{$feat}) {
            return $self-&gt;{__PACKAGE__ . "::Features"}{$feat} = $value;
        }
        throw XML::SAX::Exception::NotSupported(
            Message =&gt; "The feature '$feat' is not supported by " . ref($self),
            Exception =&gt; undef,
            );
    }
    throw XML::SAX::Exception::NotRecognized(
        Message =&gt; "The feature '$feat' is not recognized by " . ref($self),
        Exception =&gt; undef,
        );
}
#-------------------------------------------------------------------#

#-------------------------------------------------------------------#
# get_handler and friends
#-------------------------------------------------------------------#
sub get_handler {
    my $self = shift;
    my $handler_type = shift;
    $handler_type ||= 'Handler';
    return  defined( $self-&gt;{$handler_type} ) ? $self-&gt;{$handler_type} : undef;
}

sub get_document_handler {
    my $self = shift;
    return $self-&gt;get_handler('DocumentHandler', @_);
}

sub get_content_handler {
    my $self = shift;
    return $self-&gt;get_handler('ContentHandler', @_);
}

sub get_dtd_handler {
    my $self = shift;
    return $self-&gt;get_handler('DTDHandler', @_);
}

sub get_lexical_handler {
    my $self = shift;
    return $self-&gt;get_handler('LexicalHandler', @_);
}

sub get_decl_handler {
    my $self = shift;
    return $self-&gt;get_handler('DeclHandler', @_);
}

sub get_error_handler {
    my $self = shift;
    return $self-&gt;get_handler('ErrorHandler', @_);
}

sub get_entity_resolver {
    my $self = shift;
    return $self-&gt;get_handler('EntityResolver', @_);
}
#-------------------------------------------------------------------#

#-------------------------------------------------------------------#
# set_handler and friends
#-------------------------------------------------------------------#
sub set_handler {
    my $self = shift;
    my ($new_handler, $handler_type) = reverse @_;
    $handler_type ||= 'Handler';
    $self-&gt;{Methods} = {} if $self-&gt;{Methods};
    $self-&gt;{$handler_type} = $new_handler;
    $self-&gt;{ParseOptions}-&gt;{$handler_type} = $new_handler;
    return 1;
}

sub set_document_handler {
    my $self = shift;
    return $self-&gt;set_handler('DocumentHandler', @_);
}

sub set_content_handler {
    my $self = shift;
    return $self-&gt;set_handler('ContentHandler', @_);
}
sub set_dtd_handler {
    my $self = shift;
    return $self-&gt;set_handler('DTDHandler', @_);
}
sub set_lexical_handler {
    my $self = shift;
    return $self-&gt;set_handler('LexicalHandler', @_);
}
sub set_decl_handler {
    my $self = shift;
    return $self-&gt;set_handler('DeclHandler', @_);
}
sub set_error_handler {
    my $self = shift;
    return $self-&gt;set_handler('ErrorHandler', @_);
}
sub set_entity_resolver {
    my $self = shift;
    return $self-&gt;set_handler('EntityResolver', @_);
}

#-------------------------------------------------------------------#

#-------------------------------------------------------------------#
# supported_features
#-------------------------------------------------------------------#
sub supported_features {
    my $self = shift;
    # Only namespaces are required by all parsers
    return (
        'http://xml.org/sax/features/namespaces',
    );
}
#-------------------------------------------------------------------#

sub no_op {
    # this space intentionally blank
}


package XML::SAX::Base::NoHandler;
BEGIN {
  $XML::SAX::Base::NoHandler::VERSION = '1.07';
}

# we need a fake handler that doesn't implement anything, this
# simplifies the code a lot (though given the recent changes,
# it may be better to do without)
sub new {
    #warn "no handler called\n";
    return bless {};
}

1;

__END__

=head1 NAME

XML::SAX::Base - Base class SAX Drivers and Filters

=head1 SYNOPSIS

  package MyFilter;
  use XML::SAX::Base;
  @ISA = ('XML::SAX::Base');

=head1 DESCRIPTION

This module has a very simple task - to be a base class for PerlSAX
drivers and filters. It's default behaviour is to pass the input directly
to the output unchanged. It can be useful to use this module as a base class
so you don't have to, for example, implement the characters() callback.

The main advantages that it provides are easy dispatching of events the right
way (ie it takes care for you of checking that the handler has implemented
that method, or has defined an AUTOLOAD), and the guarantee that filters
will pass along events that they aren't implementing to handlers downstream
that might nevertheless be interested in them.

=head1 WRITING SAX DRIVERS AND FILTERS

Writing SAX Filters is tremendously easy: all you need to do is
inherit from this module, and define the events you want to handle. A
more detailed explanation can be found at
http://www.xml.com/pub/a/2001/10/10/sax-filters.html.

Writing Drivers is equally simple. The one thing you need to pay
attention to is B&lt;NOT&gt; to call events yourself (this applies to Filters
as well). For instance:

  package MyFilter;
  use base qw(XML::SAX::Base);

  sub start_element {
    my $self = shift;
    my $data = shift;
    # do something
    $self-&gt;{Handler}-&gt;start_element($data); # BAD
  }

The above example works well as precisely that: an example. But it has
several faults: 1) it doesn't test to see whether the handler defines
start_element. Perhaps it doesn't want to see that event, in which
case you shouldn't throw it (otherwise it'll die). 2) it doesn't check
ContentHandler and then Handler (ie it doesn't look to see that the
user hasn't requested events on a specific handler, and if not on the
default one), 3) if it did check all that, not only would the code be
cumbersome (see this module's source to get an idea) but it would also
probably have to check for a DocumentHandler (in case this were SAX1)
and for AUTOLOADs potentially defined in all these packages. As you can
tell, that would be fairly painful. Instead of going through that,
simply remember to use code similar to the following instead:

  package MyFilter;
  use base qw(XML::SAX::Base);

  sub start_element {
    my $self = shift;
    my $data = shift;
    # do something to filter
    $self-&gt;SUPER::start_element($data); # GOOD (and easy) !
  }

This way, once you've done your job you hand the ball back to
XML::SAX::Base and it takes care of all those problems for you!

Note that the above example doesn't apply to filters only, drivers
will benefit from the exact same feature.

=head1 METHODS

A number of methods are defined within this class for the purpose of
inheritance. Some probably don't need to be overridden (eg parse_file)
but some clearly should be (eg parse). Options for these methods are
described in the PerlSAX2 specification available from
http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/~checkout~/perl-xml/libxml-perl/doc/sax-2.0.html?rev=HEAD&amp;content-type=text/html.

=over 4

=item * parse

The parse method is the main entry point to parsing documents. Internally
the parse method will detect what type of "thing" you are parsing, and
call the appropriate method in your implementation class. Here is the
mapping table of what is in the Source options (see the Perl SAX 2.0
specification for the meaning of these values):

  Source Contains           parse() calls
  ===============           =============
  CharacterStream (*)       _parse_characterstream($stream, $options)
  ByteStream                _parse_bytestream($stream, $options)
  String                    _parse_string($string, $options)
  SystemId                  _parse_systemid($string, $options)

However note that these methods may not be sensible if your driver class 
is not for parsing XML. An example might be a DBI driver that generates
XML/SAX from a database table. If that is the case, you likely want to
write your own parse() method.

Also note that the Source may contain both a PublicId entry, and an
Encoding entry. To get at these, examine $options-&gt;{Source} as passed
to your method.

(*) A CharacterStream is a filehandle that does not need any encoding
translation done on it. This is implemented as a regular filehandle
and only works under Perl 5.7.2 or higher using PerlIO. To get a single
character, or number of characters from it, use the perl core read()
function. To get a single byte from it (or number of bytes), you can 
use sysread(). The encoding of the stream should be in the Encoding
entry for the Source.

=item * parse_file, parse_uri, parse_string

These are all convenience variations on parse(), and in fact simply
set up the options before calling it. You probably don't need to
override these.

=item * get_options

This is a convenience method to get options in SAX2 style, or more
generically either as hashes or as hashrefs (it returns a hashref).
You will probably want to use this method in your own implementations
of parse() and of new().

=item * get_feature, set_feature

These simply get and set features, and throw the
appropriate exceptions defined in the specification if need be.

If your subclass defines features not defined in this one,
then you should override these methods in such a way that they check for
your features first, and then call the base class's methods
for features not defined by your class. An example would be:

  sub get_feature {
      my $self = shift;
      my $feat = shift;
      if (exists $MY_FEATURES{$feat}) {
          # handle the feature in various ways
      }
      else {
          return $self-&gt;SUPER::get_feature($feat);
      }
  }

Currently this part is unimplemented.


=item * set_handler

This method takes a handler type (Handler, ContentHandler, etc.) and a
handler object as arguments, and changes the current handler for that
handler type, while taking care of resetting the internal state that 
needs to be reset. This allows one to change a handler during parse
without running into problems (changing it on the parser object 
directly will most likely cause trouble).

=item * set_document_handler, set_content_handler, set_dtd_handler, set_lexical_handler, set_decl_handler, set_error_handler, set_entity_resolver

These are just simple wrappers around the former method, and take a
handler object as their argument. Internally they simply call
set_handler with the correct arguments.

=item * get_handler

The inverse of set_handler, this method takes a an optional string containing a handler type (DTDHandler, 
ContentHandler, etc. 'Handler' is used if no type is passed). It returns a reference to the object that implements
that that class, or undef if that handler type is not set for the current driver/filter. 

=item * get_document_handler, get_content_handler, get_dtd_handler, get_lexical_handler, get_decl_handler, 
get_error_handler, get_entity_resolver

These are just simple wrappers around the get_handler() method, and take no arguments. Internally 
they simply call get_handler with the correct handler type name.

=back

It would be rather useless to describe all the methods that this
module implements here. They are all the methods supported in SAX1 and
SAX2. In case your memory is a little short, here is a list. The
apparent duplicates are there so that both versions of SAX can be
supported.

=over 4

=item * start_document

=item * end_document

=item * start_element

=item * start_document

=item * end_document

=item * start_element

=item * end_element

=item * characters

=item * processing_instruction

=item * ignorable_whitespace

=item * set_document_locator

=item * start_prefix_mapping

=item * end_prefix_mapping

=item * skipped_entity

=item * start_cdata

=item * end_cdata

=item * comment

=item * entity_reference

=item * notation_decl

=item * unparsed_entity_decl

=item * element_decl

=item * attlist_decl

=item * doctype_decl

=item * xml_decl

=item * entity_decl

=item * attribute_decl

=item * internal_entity_decl

=item * external_entity_decl

=item * resolve_entity

=item * start_dtd

=item * end_dtd

=item * start_entity

=item * end_entity

=item * warning

=item * error

=item * fatal_error

=back

=head1 TODO

  - more tests
  - conform to the "SAX Filters" and "Java and DOM compatibility"
    sections of the SAX2 document.

=head1 AUTHOR

Kip Hampton (khampton@totalcinema.com) did most of the work, after porting
it from XML::Filter::Base.

Robin Berjon (robin@knowscape.com) pitched in with patches to make it 
usable as a base for drivers as well as filters, along with other patches.

Matt Sergeant (matt@sergeant.org) wrote the original XML::Filter::Base,
and patched a few things here and there, and imported it into
the XML::SAX distribution.

=head1 SEE ALSO

L&lt;XML::SAX&gt;

=cut

</pre></body></html>