package XML::SAX::Base;

use strict;
use vars qw($VERSION);

$VERSION = '1.00';

# version 0.10 - Kip Hampton <khampton@totalcinema.com>
# version 0.13 - Robin Berjon <robin@knowscape.com>
# version 0.15 - Kip Hampton <khampton@totalcinema.com>
# version 0.17 - Kip Hampton <khampton@totalcinema.com>
# version 0.19 - Kip Hampton <khampton@totalcinema.com>
# version 0.21 - Kip Hampton <khampton@totalcinema.com>
# version 0.22 - Robin Berjon <robin@knowscape.com>
# version 0.23 - Matt Sergeant <matt@sergeant.org>
# version 0.24 - Robin Berjon <robin@knowscape.com>
# version 0.25 - Kip Hampton <khampton@totalcinema.com>
# version 1.00 - Kip Hampton <khampton@totalcinema.com>

#-----------------------------------------------------#
# STOP!!!!!
#
# This file is generated by the 'Makefile.PL' file
# that ships with the XML::SAX distribution.
# If you need to make changes, patch that file NOT
# this one.
#-----------------------------------------------------#

package XML::SAX::Base;

use strict;
use vars qw($VERSION);
use XML::SAX::Exception qw();
$VERSION = '0.25';

sub notation_decl {
    my $self = shift;
    my $method;
    if (defined $self->{Methods}->{'notation_decl'}) {
        $self->{Methods}->{'notation_decl'}->(@_);
    }
    elsif (defined $self->{'DTDHandler'} and $method = $self->{'DTDHandler'}->can('notation_decl') ) {
        $self->{Methods}->{'notation_decl'} = sub { $self->{DTDHandler}->notation_decl(@_) };
        $method->($self->{DTDHandler}, @_);
    }
    elsif (defined $self->{'Handler'} and $method = $self->{'Handler'}->can('notation_decl') ) {
        $self->{Methods}->{'notation_decl'} = sub { $self->{Handler}->notation_decl(@_) };
        $method->($self->{Handler}, @_);
    }
    elsif (defined $self->{'DTDHandler'} and $self->{'DTDHandler'}->can('AUTOLOAD') ) {
        eval { $self->{'DTDHandler'}->notation_decl(@_) };
        if ($@) {
            die $@;
        }
        else {
            $self->{Methods}->{'notation_decl'} = sub { $self->{'DTDHandler'}->notation_decl(@_) };
        }
    }
    elsif (defined $self->{'Handler'} and $self->{'Handler'}->can('AUTOLOAD') ) {
        eval { $self->{'Handler'}->notation_decl(@_) };
        if ($@) {
            die $@;
        }
        else {
            $self->{Methods}->{'notation_decl'} = sub { $self->{'Handler'}->notation_decl(@_) };
        }
    }
   else {
       $self->{Methods}->{'notation_decl'} = sub { $self->no_op };
   }

}

sub resolve_entity {
    my $self = shift;
    my $method;
    if (defined $self->{Methods}->{'resolve_entity'}) {
        $self->{Methods}->{'resolve_entity'}->(@_);
    }
    elsif (defined $self->{'EntityResolver'} and $method = $self->{'EntityResolver'}->can('resolve_entity') ) {
        $self->{Methods}->{'resolve_entity'} = sub { $self->{EntityResolver}->resolve_entity(@_) };
        $method->($self->{EntityResolver}, @_);
    }
    elsif (defined $self->{'Handler'} and $method = $self->{'Handler'}->can('resolve_entity') ) {
        $self->{Methods}->{'resolve_entity'} = sub { $self->{Handler}->resolve_entity(@_) };
        $method->($self->{Handler}, @_);
    }
    elsif (defined $self->{'EntityResolver'} and $self->{'EntityResolver'}->can('AUTOLOAD') ) {
        eval { $self->{'EntityResolver'}->resolve_entity(@_) };
        if ($@) {
            die $@;
        }
        else {
            $self->{Methods}->{'resolve_entity'} = sub { $self->{'EntityResolver'}->resolve_entity(@_) };
        }
    }
    elsif (defined $self->{'Handler'} and $self->{'Handler'}->can('AUTOLOAD') ) {
        eval { $self->{'Handler'}->resolve_entity(@_) };
        if ($@) {
            die $@;
        }
        else {
            $self->{Methods}->{'resolve_entity'} = sub { $self->{'Handler'}->resolve_entity(@_) };
        }
    }
   else {
       $self->{Methods}->{'resolve_entity'} = sub { $self->no_op };
   }

}

sub start_cdata {
    my $self = shift;
    my $method;
    if (defined $self->{Methods}->{'start_cdata'}) {
        $self->{Methods}->{'start_cdata'}->(@_);
    }
    elsif (defined $self->{'DocumentHandler'} and $method = $self->{'DocumentHandler'}->can('start_cdata') ) {
        $self->{Methods}->{'start_cdata'} = sub { $self->{DocumentHandler}->start_cdata(@_) };
        $method->($self->{DocumentHandler}, @_);
    }
    elsif (defined $self->{'LexicalHandler'} and $method = $self->{'LexicalHandler'}->can('start_cdata') ) {
        $self->{Methods}->{'start_cdata'} = sub { $self->{LexicalHandler}->start_cdata(@_) };
        $method->($self->{LexicalHandler}, @_);
    }
    elsif (defined $self->{'Handler'} and $method = $self->{'Handler'}->can('start_cdata') ) {
        $self->{Methods}->{'start_cdata'} = sub { $self->{Handler}->start_cdata(@_) };
        $method->($self->{Handler}, @_);
    }
    elsif (defined $self->{'DocumentHandler'} and $self->{'DocumentHandler'}->can('AUTOLOAD') ) {
        eval { $self->{'DocumentHandler'}->start_cdata(@_) };
        if ($@) {
            die $@;
        }
        else {
            $self->{Methods}->{'start_cdata'} = sub { $self->{'DocumentHandler'}->start_cdata(@_) };
        }
    }
    elsif (defined $self->{'LexicalHandler'} and $self->{'LexicalHandler'}->can('AUTOLOAD') ) {
        eval { $self->{'LexicalHandler'}->start_cdata(@_) };
        if ($@) {
            die $@;
        }
        else {
            $self->{Methods}->{'start_cdata'} = sub { $self->{'LexicalHandler'}->start_cdata(@_) };
        }
    }
    elsif (defined $self->{'Handler'} and $self->{'Handler'}->can('AUTOLOAD') ) {
        eval { $self->{'Handler'}->start_cdata(@_) };
        if ($@) {
            die $@;
        }
        else {
            $self->{Methods}->{'start_cdata'} = sub { $self->{'Handler'}->start_cdata(@_) };
        }
    }
   else {
       $self->{Methods}->{'start_cdata'} = sub { $self->no_op };
   }

}

sub set_document_locator {
    my $self = shift;
    my $method;
    if (defined $self->{Methods}->{'set_document_locator'}) {
        $self->{Methods}->{'set_document_locator'}->(@_);
    }
    elsif (defined $self->{'ContentHandler'} and $method = $self->{'ContentHandler'}->can('set_document_locator') ) {
        $self->{Methods}->{'set_document_locator'} = sub { $self->{ContentHandler}->set_document_locator(@_) };
        $method->($self->{ContentHandler}, @_);
    }
    elsif (defined $self->{'DocumentHandler'} and $method = $self->{'DocumentHandler'}->can('set_document_locator') ) {
        $self->{Methods}->{'set_document_locator'} = sub { $self->{DocumentHandler}->set_document_locator(@_) };
        $method->($self->{DocumentHandler}, @_);
    }
    elsif (defined $self->{'Handler'} and $method = $self->{'Handler'}->can('set_document_locator') ) {
        $self->{Methods}->{'set_document_locator'} = sub { $self->{Handler}->set_document_locator(@_) };
        $method->($self->{Handler}, @_);
    }
    elsif (defined $self->{'ContentHandler'} and $self->{'ContentHandler'}->can('AUTOLOAD') ) {
        eval { $self->{'ContentHandler'}->set_document_locator(@_) };
        if ($@) {
            die $@;
        }
        else {
            $self->{Methods}->{'set_document_locator'} = sub { $self->{'ContentHandler'}->set_document_locator(@_) };
        }
    }
    elsif (defined $self->{'DocumentHandler'} and $self->{'DocumentHandler'}->can('AUTOLOAD') ) {
        eval { $self->{'DocumentHandler'}->set_document_locator(@_) };
        if ($@) {
            die $@;
        }
        else {
            $self->{Methods}->{'set_document_locator'} = sub { $self->{'DocumentHandler'}->set_document_locator(@_) };
        }
    }
    elsif (defined $self->{'Handler'} and $self->{'Handler'}->can('AUTOLOAD') ) {
        eval { $self->{'Handler'}->set_document_locator(@_) };
        if ($@) {
            die $@;
        }
        else {
            $self->{Methods}->{'set_document_locator'} = sub { $self->{'Handler'}->set_document_locator(@_) };
        }
    }
   else {
       $self->{Methods}->{'set_document_locator'} = sub { $self->no_op };
   }

}

sub xml_decl {
    my $self = shift;
    my $method;
    if (defined $self->{Methods}->{'xml_decl'}) {
        $self->{Methods}->{'xml_decl'}->(@_);
    }
    elsif (defined $self->{'DTDHandler'} and $method = $self->{'DTDHandler'}->can('xml_decl') ) {
        $self->{Methods}->{'xml_decl'} = sub { $self->{DTDHandler}->xml_decl(@_) };
        $method->($self->{DTDHandler}, @_);
    }
    elsif (defined $self->{'Handler'} and $method = $self->{'Handler'}->can('xml_decl') ) {
        $self->{Methods}->{'xml_decl'} = sub { $self->{Handler}->xml_decl(@_) };
        $method->($self->{Handler}, @_);
    }
    elsif (defined $self->{'DTDHandler'} and $self->{'DTDHandler'}->can('AUTOLOAD') ) {
        eval { $self->{'DTDHandler'}->xml_decl(@_) };
        if ($@) {
            die $@;
        }
        else {
            $self->{Methods}->{'xml_decl'} = sub { $self->{'DTDHandler'}->xml_decl(@_) };
        }
    }
    elsif (defined $self->{'Handler'} and $self->{'Handler'}->can('AUTOLOAD') ) {
        eval { $self->{'Handler'}->xml_decl(@_) };
        if ($@) {
            die $@;
        }
        else {
            $self->{Methods}->{'xml_decl'} = sub { $self->{'Handler'}->xml_decl(@_) };
        }
    }
   else {
       $self->{Methods}->{'xml_decl'} = sub { $self->no_op };
   }

}

sub processing_instruction {
    my $self = shift;
    my $method;
    if (defined $self->{Methods}->{'processing_instruction'}) {
        $self->{Methods}->{'processing_instruction'}->(@_);
    }
    elsif (defined $self->{'ContentHandler'} and $method = $self->{'ContentHandler'}->can('processing_instruction') ) {
        $self->{Methods}->{'processing_instruction'} = sub { $self->{ContentHandler}->processing_instruction(@_) };
        $method->($self->{ContentHandler}, @_);
    }
    elsif (defined $self->{'DocumentHandler'} and $method = $self->{'DocumentHandler'}->can('processing_instruction') ) {
        $self->{Methods}->{'processing_instruction'} = sub { $self->{DocumentHandler}->processing_instruction(@_) };
        $method->($self->{DocumentHandler}, @_);
    }
    elsif (defined $self->{'Handler'} and $method = $self->{'Handler'}->can('processing_instruction') ) {
        $self->{Methods}->{'processing_instruction'} = sub { $self->{Handler}->processing_instruction(@_) };
        $method->($self->{Handler}, @_);
    }
    elsif (defined $self->{'ContentHandler'} and $self->{'ContentHandler'}->can('AUTOLOAD') ) {
        eval { $self->{'ContentHandler'}->processing_instruction(@_) };
        if ($@) {
            die $@;
        }
        else {
            $self->{Methods}->{'processing_instruction'} = sub { $self->{'ContentHandler'}->processing_instruction(@_) };
        }
    }
    elsif (defined $self->{'DocumentHandler'} and $self->{'DocumentHandler'}->can('AUTOLOAD') ) {
        eval { $self->{'DocumentHandler'}->processing_instruction(@_) };
        if ($@) {
            die $@;
        }
        else {
            $self->{Methods}->{'processing_instruction'} = sub { $self->{'DocumentHandler'}->processing_instruction(@_) };
        }
    }
    elsif (defined $self->{'Handler'} and $self->{'Handler'}->can('AUTOLOAD') ) {
        eval { $self->{'Handler'}->processing_instruction(@_) };
        if ($@) {
            die $@;
        }
        else {
            $self->{Methods}->{'processing_instruction'} = sub { $self->{'Handler'}->processing_instruction(@_) };
        }
    }
   else {
       $self->{Methods}->{'processing_instruction'} = sub { $self->no_op };
   }

}

sub start_prefix_mapping {
    my $self = shift;
    my $method;
    if (defined $self->{Methods}->{'start_prefix_mapping'}) {
        $self->{Methods}->{'start_prefix_mapping'}->(@_);
    }
    elsif (defined $self->{'ContentHandler'} and $method = $self->{'ContentHandler'}->can('start_prefix_mapping') ) {
        $self->{Methods}->{'start_prefix_mapping'} = sub { $self->{ContentHandler}->start_prefix_mapping(@_) };
        $method->($self->{ContentHandler}, @_);
    }
    elsif (defined $self->{'Handler'} and $method = $self->{'Handler'}->can('start_prefix_mapping') ) {
        $self->{Methods}->{'start_prefix_mapping'} = sub { $self->{Handler}->start_prefix_mapping(@_) };
        $method->($self->{Handler}, @_);
    }
    elsif (defined $self->{'ContentHandler'} and $self->{'ContentHandler'}->can('AUTOLOAD') ) {
        eval { $self->{'ContentHandler'}->start_prefix_mapping(@_) };
        if ($@) {
            die $@;
        }
        else {
            $self->{Methods}->{'start_prefix_mapping'} = sub { $self->{'ContentHandler'}->start_prefix_mapping(@_) };
        }
    }
    elsif (defined $self->{'Handler'} and $self->{'Handler'}->can('AUTOLOAD') ) {
        eval { $self->{'Handler'}->start_prefix_mapping(@_) };
        if ($@) {
            die $@;
        }
        else {
            $self->{Methods}->{'start_prefix_mapping'} = sub { $self->{'Handler'}->start_prefix_mapping(@_) };
        }
    }
   else {
       $self->{Methods}->{'start_prefix_mapping'} = sub { $self->no_op };
   }

}

sub entity_reference {
    my $self = shift;
    my $method;
    if (defined $self->{Methods}->{'entity_reference'}) {
        $self->{Methods}->{'entity_reference'}->(@_);
    }
    elsif (defined $self->{'DocumentHandler'} and $method = $self->{'DocumentHandler'}->can('entity_reference') ) {
        $self->{Methods}->{'entity_reference'} = sub { $self->{DocumentHandler}->entity_reference(@_) };
        $method->($self->{DocumentHandler}, @_);
    }
    elsif (defined $self->{'Handler'} and $method = $self->{'Handler'}->can('entity_reference') ) {
        $self->{Methods}->{'entity_reference'} = sub { $self->{Handler}->entity_reference(@_) };
        $method->($self->{Handler}, @_);
    }
    elsif (defined $self->{'DocumentHandler'} and $self->{'DocumentHandler'}->can('AUTOLOAD') ) {
        eval { $self->{'DocumentHandler'}->entity_reference(@_) };
        if ($@) {
            die $@;
        }
        else {
            $self->{Methods}->{'entity_reference'} = sub { $self->{'DocumentHandler'}->entity_reference(@_) };
        }
    }
    elsif (defined $self->{'Handler'} and $self->{'Handler'}->can('AUTOLOAD') ) {
        eval { $self->{'Handler'}->entity_reference(@_) };
        if ($@) {
            die $@;
        }
        else {
            $self->{Methods}->{'entity_reference'} = sub { $self->{'Handler'}->entity_reference(@_) };
        }
    }
   else {
       $self->{Methods}->{'entity_reference'} = sub { $self->no_op };
   }

}

sub attlist_decl {
    my $self = shift;
    my $method;
    if (defined $self->{Methods}->{'attlist_decl'}) {
        $self->{Methods}->{'attlist_decl'}->(@_);
    }
    elsif (defined $self->{'DTDHandler'} and $method = $self->{'DTDHandler'}->can('attlist_decl') ) {
        $self->{Methods}->{'attlist_decl'} = sub { $self->{DTDHandler}->attlist_decl(@_) };
        $method->($self->{DTDHandler}, @_);
    }
    elsif (defined $self->{'Handler'} and $method = $self->{'Handler'}->can('attlist_decl') ) {
        $self->{Methods}->{'attlist_decl'} = sub { $self->{Handler}->attlist_decl(@_) };
        $method->($self->{Handler}, @_);
    }
    elsif (defined $self->{'DTDHandler'} and $self->{'DTDHandler'}->can('AUTOLOAD') ) {
        eval { $self->{'DTDHandler'}->attlist_decl(@_) };
        if ($@) {
            die $@;
        }
        else {
            $self->{Methods}->{'attlist_decl'} = sub { $self->{'DTDHandler'}->attlist_decl(@_) };
        }
    }
    elsif (defined $self->{'Handler'} and $self->{'Handler'}->can('AUTOLOAD') ) {
        eval { $self->{'Handler'}->attlist_decl(@_) };
        if ($@) {
            die $@;
        }
        else {
            $self->{Methods}->{'attlist_decl'} = sub { $self->{'Handler'}->attlist_decl(@_) };
        }
    }
   else {
       $self->{Methods}->{'attlist_decl'} = sub { $self->no_op };
   }

}

sub error {
    my $self = shift;
    my $method;
    if (defined $self->{Methods}->{'error'}) {
        $self->{Methods}->{'error'}->(@_);
    }
    elsif (defined $self->{'ErrorHandler'} and $method = $self->{'ErrorHandler'}->can('error') ) {
        $self->{Methods}->{'error'} = sub { $self->{ErrorHandler}->error(@_) };
        $method->($self->{ErrorHandler}, @_);
    }
    elsif (defined $self->{'Handler'} and $method = $self->{'Handler'}->can('error') ) {
        $self->{Methods}->{'error'} = sub { $self->{Handler}->error(@_) };
        $method->($self->{Handler}, @_);
    }
    elsif (defined $self->{'ErrorHandler'} and $self->{'ErrorHandler'}->can('AUTOLOAD') ) {
        eval { $self->{'ErrorHandler'}->error(@_) };
        if ($@) {
            die $@;
        }
        else {
            $self->{Methods}->{'error'} = sub { $self->{'ErrorHandler'}->error(@_) };
        }
    }
    elsif (defined $self->{'Handler'} and $self->{'Handler'}->can('AUTOLOAD') ) {
        eval { $self->{'Handler'}->error(@_) };
        if ($@) {
            die $@;
        }
        else {
            $self->{Methods}->{'error'} = sub { $self->{'Handler'}->error(@_) };
        }
    }
   else {
       $self->{Methods}->{'error'} = sub { $self->no_op };
   }

}

sub unparsed_entity_decl {
    my $self = shift;
    my $method;
    if (defined $self->{Methods}->{'unparsed_entity_decl'}) {
        $self->{Methods}->{'unparsed_entity_decl'}->(@_);
    }
    elsif (defined $self->{'DTDHandler'} and $method = $self->{'DTDHandler'}->can('unparsed_entity_decl') ) {
        $self->{Methods}->{'unparsed_entity_decl'} = sub { $self->{DTDHandler}->unparsed_entity_decl(@_) };
        $method->($self->{DTDHandler}, @_);
    }
    elsif (defined $self->{'Handler'} and $method = $self->{'Handler'}->can('unparsed_entity_decl') ) {
        $self->{Methods}->{'unparsed_entity_decl'} = sub { $self->{Handler}->unparsed_entity_decl(@_) };
        $method->($self->{Handler}, @_);
    }
    elsif (defined $self->{'DTDHandler'} and $self->{'DTDHandler'}->can('AUTOLOAD') ) {
        eval { $self->{'DTDHandler'}->unparsed_entity_decl(@_) };
        if ($@) {
            die $@;
        }
        else {
            $self->{Methods}->{'unparsed_entity_decl'} = sub { $self->{'DTDHandler'}->unparsed_entity_decl(@_) };
        }
    }
    elsif (defined $self->{'Handler'} and $self->{'Handler'}->can('AUTOLOAD') ) {
        eval { $self->{'Handler'}->unparsed_entity_decl(@_) };
        if ($@) {
            die $@;
        }
        else {
            $self->{Methods}->{'unparsed_entity_decl'} = sub { $self->{'Handler'}->unparsed_entity_decl(@_) };
        }
    }
   else {
       $self->{Methods}->{'unparsed_entity_decl'} = sub { $self->no_op };
   }

}

sub end_entity {
    my $self = shift;
    my $method;
    if (defined $self->{Methods}->{'end_entity'}) {
        $self->{Methods}->{'end_entity'}->(@_);
    }
    elsif (defined $self->{'LexicalHandler'} and $method = $self->{'LexicalHandler'}->can('end_entity') ) {
        $self->{Methods}->{'end_entity'} = sub { $self->{LexicalHandler}->end_entity(@_) };
        $method->($self->{LexicalHandler}, @_);
    }
    elsif (defined $self->{'Handler'} and $method = $self->{'Handler'}->can('end_entity') ) {
        $self->{Methods}->{'end_entity'} = sub { $self->{Handler}->end_entity(@_) };
        $method->($self->{Handler}, @_);
    }
    elsif (defined $self->{'LexicalHandler'} and $self->{'LexicalHandler'}->can('AUTOLOAD') ) {
        eval { $self->{'LexicalHandler'}->end_entity(@_) };
        if ($@) {
            die $@;
        }
        else {
            $self->{Methods}->{'end_entity'} = sub { $self->{'LexicalHandler'}->end_entity(@_) };
        }
    }
    elsif (defined $self->{'Handler'} and $self->{'Handler'}->can('AUTOLOAD') ) {
        eval { $self->{'Handler'}->end_entity(@_) };
        if ($@) {
            die $@;
        }
        else {
            $self->{Methods}->{'end_entity'} = sub { $self->{'Handler'}->end_entity(@_) };
        }
    }
   else {
       $self->{Methods}->{'end_entity'} = sub { $self->no_op };
   }

}

sub end_element {
    my $self = shift;
    my $method;
    if (defined $self->{Methods}->{'end_element'}) {
        $self->{Methods}->{'end_element'}->(@_);
    }
    elsif (defined $self->{'ContentHandler'} and $method = $self->{'ContentHandler'}->can('end_element') ) {
        $self->{Methods}->{'end_element'} = sub { $self->{ContentHandler}->end_element(@_) };
        $method->($self->{ContentHandler}, @_);
    }
    elsif (defined $self->{'DocumentHandler'} and $method = $self->{'DocumentHandler'}->can('end_element') ) {
        $self->{Methods}->{'end_element'} = sub { $self->{DocumentHandler}->end_element(@_) };
        $method->($self->{DocumentHandler}, @_);
    }
    elsif (defined $self->{'Handler'} and $method = $self->{'Handler'}->can('end_element') ) {
        $self->{Methods}->{'end_element'} = sub { $self->{Handler}->end_element(@_) };
        $method->($self->{Handler}, @_);
    }
    elsif (defined $self->{'ContentHandler'} and $self->{'ContentHandler'}->can('AUTOLOAD') ) {
        eval { $self->{'ContentHandler'}->end_element(@_) };
        if ($@) {
            die $@;
        }
        else {
            $self->{Methods}->{'end_element'} = sub { $self->{'ContentHandler'}->end_element(@_) };
        }
    }
    elsif (defined $self->{'DocumentHandler'} and $self->{'DocumentHandler'}->can('AUTOLOAD') ) {
        eval { $self->{'DocumentHandler'}->end_element(@_) };
        if ($@) {
            die $@;
        }
        else {
            $self->{Methods}->{'end_element'} = sub { $self->{'DocumentHandler'}->end_element(@_) };
        }
    }
    elsif (defined $self->{'Handler'} and $self->{'Handler'}->can('AUTOLOAD') ) {
        eval { $self->{'Handler'}->end_element(@_) };
        if ($@) {
            die $@;
        }
        else {
            $self->{Methods}->{'end_element'} = sub { $self->{'Handler'}->end_element(@_) };
        }
    }
   else {
       $self->{Methods}->{'end_element'} = sub { $self->no_op };
   }

}

sub comment {
    my $self = shift;
    my $method;
    if (defined $self->{Methods}->{'comment'}) {
        $self->{Methods}->{'comment'}->(@_);
    }
    elsif (defined $self->{'DocumentHandler'} and $method = $self->{'DocumentHandler'}->can('comment') ) {
        $self->{Methods}->{'comment'} = sub { $self->{DocumentHandler}->comment(@_) };
        $method->($self->{DocumentHandler}, @_);
    }
    elsif (defined $self->{'LexicalHandler'} and $method = $self->{'LexicalHandler'}->can('comment') ) {
        $self->{Methods}->{'comment'} = sub { $self->{LexicalHandler}->comment(@_) };
        $method->($self->{LexicalHandler}, @_);
    }
    elsif (defined $self->{'Handler'} and $method = $self->{'Handler'}->can('comment') ) {
        $self->{Methods}->{'comment'} = sub { $self->{Handler}->comment(@_) };
        $method->($self->{Handler}, @_);
    }
    elsif (defined $self->{'DocumentHandler'} and $self->{'DocumentHandler'}->can('AUTOLOAD') ) {
        eval { $self->{'DocumentHandler'}->comment(@_) };
        if ($@) {
            die $@;
        }
        else {
            $self->{Methods}->{'comment'} = sub { $self->{'DocumentHandler'}->comment(@_) };
        }
    }
    elsif (defined $self->{'LexicalHandler'} and $self->{'LexicalHandler'}->can('AUTOLOAD') ) {
        eval { $self->{'LexicalHandler'}->comment(@_) };
        if ($@) {
            die $@;
        }
        else {
            $self->{Methods}->{'comment'} = sub { $self->{'LexicalHandler'}->comment(@_) };
        }
    }
    elsif (defined $self->{'Handler'} and $self->{'Handler'}->can('AUTOLOAD') ) {
        eval { $self->{'Handler'}->comment(@_) };
        if ($@) {
            die $@;
        }
        else {
            $self->{Methods}->{'comment'} = sub { $self->{'Handler'}->comment(@_) };
        }
    }
   else {
       $self->{Methods}->{'comment'} = sub { $self->no_op };
   }

}

sub element_decl {
    my $self = shift;
    my $method;
    if (defined $self->{Methods}->{'element_decl'}) {
        $self->{Methods}->{'element_decl'}->(@_);
    }
    elsif (defined $self->{'DeclHandler'} and $method = $self->{'DeclHandler'}->can('element_decl') ) {
        $self->{Methods}->{'element_decl'} = sub { $self->{DeclHandler}->element_decl(@_) };
        $method->($self->{DeclHandler}, @_);
    }
    elsif (defined $self->{'Handler'} and $method = $self->{'Handler'}->can('element_decl') ) {
        $self->{Methods}->{'element_decl'} = sub { $self->{Handler}->element_decl(@_) };
        $method->($self->{Handler}, @_);
    }
    elsif (defined $self->{'DeclHandler'} and $self->{'DeclHandler'}->can('AUTOLOAD') ) {
        eval { $self->{'DeclHandler'}->element_decl(@_) };
        if ($@) {
            die $@;
        }
        else {
            $self->{Methods}->{'element_decl'} = sub { $self->{'DeclHandler'}->element_decl(@_) };
        }
    }
    elsif (defined $self->{'Handler'} and $self->{'Handler'}->can('AUTOLOAD') ) {
        eval { $self->{'Handler'}->element_decl(@_) };
        if ($@) {
            die $@;
        }
        else {
            $self->{Methods}->{'element_decl'} = sub { $self->{'Handler'}->element_decl(@_) };
        }
    }
   else {
       $self->{Methods}->{'element_decl'} = sub { $self->no_op };
   }

}

sub attribute_decl {
    my $self = shift;
    my $method;
    if (defined $self->{Methods}->{'attribute_decl'}) {
        $self->{Methods}->{'attribute_decl'}->(@_);
    }
    elsif (defined $self->{'DeclHandler'} and $method = $self->{'DeclHandler'}->can('attribute_decl') ) {
        $self->{Methods}->{'attribute_decl'} = sub { $self->{DeclHandler}->attribute_decl(@_) };
        $method->($self->{DeclHandler}, @_);
    }
    elsif (defined $self->{'Handler'} and $method = $self->{'Handler'}->can('attribute_decl') ) {
        $self->{Methods}->{'attribute_decl'} = sub { $self->{Handler}->attribute_decl(@_) };
        $method->($self->{Handler}, @_);
    }
    elsif (defined $self->{'DeclHandler'} and $self->{'DeclHandler'}->can('AUTOLOAD') ) {
        eval { $self->{'DeclHandler'}->attribute_decl(@_) };
        if ($@) {
            die $@;
        }
        else {
            $self->{Methods}->{'attribute_decl'} = sub { $self->{'DeclHandler'}->attribute_decl(@_) };
        }
    }
    elsif (defined $self->{'Handler'} and $self->{'Handler'}->can('AUTOLOAD') ) {
        eval { $self->{'Handler'}->attribute_decl(@_) };
        if ($@) {
            die $@;
        }
        else {
            $self->{Methods}->{'attribute_decl'} = sub { $self->{'Handler'}->attribute_decl(@_) };
        }
    }
   else {
       $self->{Methods}->{'attribute_decl'} = sub { $self->no_op };
   }

}

sub fatal_error {
    my $self = shift;
    my $method;
    if (defined $self->{Methods}->{'fatal_error'}) {
        $self->{Methods}->{'fatal_error'}->(@_);
    }
    elsif (defined $self->{'ErrorHandler'} and $method = $self->{'ErrorHandler'}->can('fatal_error') ) {
        $self->{Methods}->{'fatal_error'} = sub { $self->{ErrorHandler}->fatal_error(@_) };
        $method->($self->{ErrorHandler}, @_);
    }
    elsif (defined $self->{'Handler'} and $method = $self->{'Handler'}->can('fatal_error') ) {
        $self->{Methods}->{'fatal_error'} = sub { $self->{Handler}->fatal_error(@_) };
        $method->($self->{Handler}, @_);
    }
    elsif (defined $self->{'ErrorHandler'} and $self->{'ErrorHandler'}->can('AUTOLOAD') ) {
        eval { $self->{'ErrorHandler'}->fatal_error(@_) };
        if ($@) {
            die $@;
        }
        else {
            $self->{Methods}->{'fatal_error'} = sub { $self->{'ErrorHandler'}->fatal_error(@_) };
        }
    }
    elsif (defined $self->{'Handler'} and $self->{'Handler'}->can('AUTOLOAD') ) {
        eval { $self->{'Handler'}->fatal_error(@_) };
        if ($@) {
            die $@;
        }
        else {
            $self->{Methods}->{'fatal_error'} = sub { $self->{'Handler'}->fatal_error(@_) };
        }
    }
   else {
       $self->{Methods}->{'fatal_error'} = sub { $self->no_op };
   }

}

sub start_document {
    my $self = shift;
    my $method;
    if (defined $self->{Methods}->{'start_document'}) {
        $self->{Methods}->{'start_document'}->(@_);
    }
    elsif (defined $self->{'ContentHandler'} and $method = $self->{'ContentHandler'}->can('start_document') ) {
        $self->{Methods}->{'start_document'} = sub { $self->{ContentHandler}->start_document(@_) };
        $method->($self->{ContentHandler}, @_);
    }
    elsif (defined $self->{'DocumentHandler'} and $method = $self->{'DocumentHandler'}->can('start_document') ) {
        $self->{Methods}->{'start_document'} = sub { $self->{DocumentHandler}->start_document(@_) };
        $method->($self->{DocumentHandler}, @_);
    }
    elsif (defined $self->{'Handler'} and $method = $self->{'Handler'}->can('start_document') ) {
        $self->{Methods}->{'start_document'} = sub { $self->{Handler}->start_document(@_) };
        $method->($self->{Handler}, @_);
    }
    elsif (defined $self->{'ContentHandler'} and $self->{'ContentHandler'}->can('AUTOLOAD') ) {
        eval { $self->{'ContentHandler'}->start_document(@_) };
        if ($@) {
            die $@;
        }
        else {
            $self->{Methods}->{'start_document'} = sub { $self->{'ContentHandler'}->start_document(@_) };
        }
    }
    elsif (defined $self->{'DocumentHandler'} and $self->{'DocumentHandler'}->can('AUTOLOAD') ) {
        eval { $self->{'DocumentHandler'}->start_document(@_) };
        if ($@) {
            die $@;
        }
        else {
            $self->{Methods}->{'start_document'} = sub { $self->{'DocumentHandler'}->start_document(@_) };
        }
    }
    elsif (defined $self->{'Handler'} and $self->{'Handler'}->can('AUTOLOAD') ) {
        eval { $self->{'Handler'}->start_document(@_) };
        if ($@) {
            die $@;
        }
        else {
            $self->{Methods}->{'start_document'} = sub { $self->{'Handler'}->start_document(@_) };
        }
    }
   else {
       $self->{Methods}->{'start_document'} = sub { $self->no_op };
   }

}

sub external_entity_decl {
    my $self = shift;
    my $method;
    if (defined $self->{Methods}->{'external_entity_decl'}) {
        $self->{Methods}->{'external_entity_decl'}->(@_);
    }
    elsif (defined $self->{'DeclHandler'} and $method = $self->{'DeclHandler'}->can('external_entity_decl') ) {
        $self->{Methods}->{'external_entity_decl'} = sub { $self->{DeclHandler}->external_entity_decl(@_) };
        $method->($self->{DeclHandler}, @_);
    }
    elsif (defined $self->{'Handler'} and $method = $self->{'Handler'}->can('external_entity_decl') ) {
        $self->{Methods}->{'external_entity_decl'} = sub { $self->{Handler}->external_entity_decl(@_) };
        $method->($self->{Handler}, @_);
    }
    elsif (defined $self->{'DeclHandler'} and $self->{'DeclHandler'}->can('AUTOLOAD') ) {
        eval { $self->{'DeclHandler'}->external_entity_decl(@_) };
        if ($@) {
            die $@;
        }
        else {
            $self->{Methods}->{'external_entity_decl'} = sub { $self->{'DeclHandler'}->external_entity_decl(@_) };
        }
    }
    elsif (defined $self->{'Handler'} and $self->{'Handler'}->can('AUTOLOAD') ) {
        eval { $self->{'Handler'}->external_entity_decl(@_) };
        if ($@) {
            die $@;
        }
        else {
            $self->{Methods}->{'external_entity_decl'} = sub { $self->{'Handler'}->external_entity_decl(@_) };
        }
    }
   else {
       $self->{Methods}->{'external_entity_decl'} = sub { $self->no_op };
   }

}

sub warning {
    my $self = shift;
    my $method;
    if (defined $self->{Methods}->{'warning'}) {
        $self->{Methods}->{'warning'}->(@_);
    }
    elsif (defined $self->{'ErrorHandler'} and $method = $self->{'ErrorHandler'}->can('warning') ) {
        $self->{Methods}->{'warning'} = sub { $self->{ErrorHandler}->warning(@_) };
        $method->($self->{ErrorHandler}, @_);
    }
    elsif (defined $self->{'Handler'} and $method = $self->{'Handler'}->can('warning') ) {
        $self->{Methods}->{'warning'} = sub { $self->{Handler}->warning(@_) };
        $method->($self->{Handler}, @_);
    }
    elsif (defined $self->{'ErrorHandler'} and $self->{'ErrorHandler'}->can('AUTOLOAD') ) {
        eval { $self->{'ErrorHandler'}->warning(@_) };
        if ($@) {
            die $@;
        }
        else {
            $self->{Methods}->{'warning'} = sub { $self->{'ErrorHandler'}->warning(@_) };
        }
    }
    elsif (defined $self->{'Handler'} and $self->{'Handler'}->can('AUTOLOAD') ) {
        eval { $self->{'Handler'}->warning(@_) };
        if ($@) {
            die $@;
        }
        else {
            $self->{Methods}->{'warning'} = sub { $self->{'Handler'}->warning(@_) };
        }
    }
   else {
       $self->{Methods}->{'warning'} = sub { $self->no_op };
   }

}

sub doctype_decl {
    my $self = shift;
    my $method;
    if (defined $self->{Methods}->{'doctype_decl'}) {
        $self->{Methods}->{'doctype_decl'}->(@_);
    }
    elsif (defined $self->{'DTDHandler'} and $method = $self->{'DTDHandler'}->can('doctype_decl') ) {
        $self->{Methods}->{'doctype_decl'} = sub { $self->{DTDHandler}->doctype_decl(@_) };
        $method->($self->{DTDHandler}, @_);
    }
    elsif (defined $self->{'Handler'} and $method = $self->{'Handler'}->can('doctype_decl') ) {
        $self->{Methods}->{'doctype_decl'} = sub { $self->{Handler}->doctype_decl(@_) };
        $method->($self->{Handler}, @_);
    }
    elsif (defined $self->{'DTDHandler'} and $self->{'DTDHandler'}->can('AUTOLOAD') ) {
        eval { $self->{'DTDHandler'}->doctype_decl(@_) };
        if ($@) {
            die $@;
        }
        else {
            $self->{Methods}->{'doctype_decl'} = sub { $self->{'DTDHandler'}->doctype_decl(@_) };
        }
    }
    elsif (defined $self->{'Handler'} and $self->{'Handler'}->can('AUTOLOAD') ) {
        eval { $self->{'Handler'}->doctype_decl(@_) };
        if ($@) {
            die $@;
        }
        else {
            $self->{Methods}->{'doctype_decl'} = sub { $self->{'Handler'}->doctype_decl(@_) };
        }
    }
   else {
       $self->{Methods}->{'doctype_decl'} = sub { $self->no_op };
   }

}

sub entity_decl {
    my $self = shift;
    my $method;
    if (defined $self->{Methods}->{'entity_decl'}) {
        $self->{Methods}->{'entity_decl'}->(@_);
    }
    elsif (defined $self->{'DTDHandler'} and $method = $self->{'DTDHandler'}->can('entity_decl') ) {
        $self->{Methods}->{'entity_decl'} = sub { $self->{DTDHandler}->entity_decl(@_) };
        $method->($self->{DTDHandler}, @_);
    }
    elsif (defined $self->{'Handler'} and $method = $self->{'Handler'}->can('entity_decl') ) {
        $self->{Methods}->{'entity_decl'} = sub { $self->{Handler}->entity_decl(@_) };
        $method->($self->{Handler}, @_);
    }
    elsif (defined $self->{'DTDHandler'} and $self->{'DTDHandler'}->can('AUTOLOAD') ) {
        eval { $self->{'DTDHandler'}->entity_decl(@_) };
        if ($@) {
            die $@;
        }
        else {
            $self->{Methods}->{'entity_decl'} = sub { $self->{'DTDHandler'}->entity_decl(@_) };
        }
    }
    elsif (defined $self->{'Handler'} and $self->{'Handler'}->can('AUTOLOAD') ) {
        eval { $self->{'Handler'}->entity_decl(@_) };
        if ($@) {
            die $@;
        }
        else {
            $self->{Methods}->{'entity_decl'} = sub { $self->{'Handler'}->entity_decl(@_) };
        }
    }
   else {
       $self->{Methods}->{'entity_decl'} = sub { $self->no_op };
   }

}

sub end_document {
    my $self = shift;
    my $method;
    if (defined $self->{Methods}->{'end_document'}) {
        $self->{Methods}->{'end_document'}->(@_);
    }
    elsif (defined $self->{'ContentHandler'} and $method = $self->{'ContentHandler'}->can('end_document') ) {
        $self->{Methods}->{'end_document'} = sub { $self->{ContentHandler}->end_document(@_) };
        $method->($self->{ContentHandler}, @_);
    }
    elsif (defined $self->{'DocumentHandler'} and $method = $self->{'DocumentHandler'}->can('end_document') ) {
        $self->{Methods}->{'end_document'} = sub { $self->{DocumentHandler}->end_document(@_) };
        $method->($self->{DocumentHandler}, @_);
    }
    elsif (defined $self->{'Handler'} and $method = $self->{'Handler'}->can('end_document') ) {
        $self->{Methods}->{'end_document'} = sub { $self->{Handler}->end_document(@_) };
        $method->($self->{Handler}, @_);
    }
    elsif (defined $self->{'ContentHandler'} and $self->{'ContentHandler'}->can('AUTOLOAD') ) {
        eval { $self->{'ContentHandler'}->end_document(@_) };
        if ($@) {
            die $@;
        }
        else {
            $self->{Methods}->{'end_document'} = sub { $self->{'ContentHandler'}->end_document(@_) };
        }
    }
    elsif (defined $self->{'DocumentHandler'} and $self->{'DocumentHandler'}->can('AUTOLOAD') ) {
        eval { $self->{'DocumentHandler'}->end_document(@_) };
        if ($@) {
            die $@;
        }
        else {
            $self->{Methods}->{'end_document'} = sub { $self->{'DocumentHandler'}->end_document(@_) };
        }
    }
    elsif (defined $self->{'Handler'} and $self->{'Handler'}->can('AUTOLOAD') ) {
        eval { $self->{'Handler'}->end_document(@_) };
        if ($@) {
            die $@;
        }
        else {
            $self->{Methods}->{'end_document'} = sub { $self->{'Handler'}->end_document(@_) };
        }
    }
   else {
       $self->{Methods}->{'end_document'} = sub { $self->no_op };
   }

}

sub start_element {
    my $self = shift;
    my $method;
    if (defined $self->{Methods}->{'start_element'}) {
        $self->{Methods}->{'start_element'}->(@_);
    }
    elsif (defined $self->{'ContentHandler'} and $method = $self->{'ContentHandler'}->can('start_element') ) {
        $self->{Methods}->{'start_element'} = sub { $self->{ContentHandler}->start_element(@_) };
        $method->($self->{ContentHandler}, @_);
    }
    elsif (defined $self->{'DocumentHandler'} and $method = $self->{'DocumentHandler'}->can('start_element') ) {
        $self->{Methods}->{'start_element'} = sub { $self->{DocumentHandler}->start_element(@_) };
        $method->($self->{DocumentHandler}, @_);
    }
    elsif (defined $self->{'Handler'} and $method = $self->{'Handler'}->can('start_element') ) {
        $self->{Methods}->{'start_element'} = sub { $self->{Handler}->start_element(@_) };
        $method->($self->{Handler}, @_);
    }
    elsif (defined $self->{'ContentHandler'} and $self->{'ContentHandler'}->can('AUTOLOAD') ) {
        eval { $self->{'ContentHandler'}->start_element(@_) };
        if ($@) {
            die $@;
        }
        else {
            $self->{Methods}->{'start_element'} = sub { $self->{'ContentHandler'}->start_element(@_) };
        }
    }
    elsif (defined $self->{'DocumentHandler'} and $self->{'DocumentHandler'}->can('AUTOLOAD') ) {
        eval { $self->{'DocumentHandler'}->start_element(@_) };
        if ($@) {
            die $@;
        }
        else {
            $self->{Methods}->{'start_element'} = sub { $self->{'DocumentHandler'}->start_element(@_) };
        }
    }
    elsif (defined $self->{'Handler'} and $self->{'Handler'}->can('AUTOLOAD') ) {
        eval { $self->{'Handler'}->start_element(@_) };
        if ($@) {
            die $@;
        }
        else {
            $self->{Methods}->{'start_element'} = sub { $self->{'Handler'}->start_element(@_) };
        }
    }
   else {
       $self->{Methods}->{'start_element'} = sub { $self->no_op };
   }

}

sub start_dtd {
    my $self = shift;
    my $method;
    if (defined $self->{Methods}->{'start_dtd'}) {
        $self->{Methods}->{'start_dtd'}->(@_);
    }
    elsif (defined $self->{'LexicalHandler'} and $method = $self->{'LexicalHandler'}->can('start_dtd') ) {
        $self->{Methods}->{'start_dtd'} = sub { $self->{LexicalHandler}->start_dtd(@_) };
        $method->($self->{LexicalHandler}, @_);
    }
    elsif (defined $self->{'Handler'} and $method = $self->{'Handler'}->can('start_dtd') ) {
        $self->{Methods}->{'start_dtd'} = sub { $self->{Handler}->start_dtd(@_) };
        $method->($self->{Handler}, @_);
    }
    elsif (defined $self->{'LexicalHandler'} and $self->{'LexicalHandler'}->can('AUTOLOAD') ) {
        eval { $self->{'LexicalHandler'}->start_dtd(@_) };
        if ($@) {
            die $@;
        }
        else {
            $self->{Methods}->{'start_dtd'} = sub { $self->{'LexicalHandler'}->start_dtd(@_) };
        }
    }
    elsif (defined $self->{'Handler'} and $self->{'Handler'}->can('AUTOLOAD') ) {
        eval { $self->{'Handler'}->start_dtd(@_) };
        if ($@) {
            die $@;
        }
        else {
            $self->{Methods}->{'start_dtd'} = sub { $self->{'Handler'}->start_dtd(@_) };
        }
    }
   else {
       $self->{Methods}->{'start_dtd'} = sub { $self->no_op };
   }

}

sub end_prefix_mapping {
    my $self = shift;
    my $method;
    if (defined $self->{Methods}->{'end_prefix_mapping'}) {
        $self->{Methods}->{'end_prefix_mapping'}->(@_);
    }
    elsif (defined $self->{'ContentHandler'} and $method = $self->{'ContentHandler'}->can('end_prefix_mapping') ) {
        $self->{Methods}->{'end_prefix_mapping'} = sub { $self->{ContentHandler}->end_prefix_mapping(@_) };
        $method->($self->{ContentHandler}, @_);
    }
    elsif (defined $self->{'Handler'} and $method = $self->{'Handler'}->can('end_prefix_mapping') ) {
        $self->{Methods}->{'end_prefix_mapping'} = sub { $self->{Handler}->end_prefix_mapping(@_) };
        $method->($self->{Handler}, @_);
    }
    elsif (defined $self->{'ContentHandler'} and $self->{'ContentHandler'}->can('AUTOLOAD') ) {
        eval { $self->{'ContentHandler'}->end_prefix_mapping(@_) };
        if ($@) {
            die $@;
        }
        else {
            $self->{Methods}->{'end_prefix_mapping'} = sub { $self->{'ContentHandler'}->end_prefix_mapping(@_) };
        }
    }
    elsif (defined $self->{'Handler'} and $self->{'Handler'}->can('AUTOLOAD') ) {
        eval { $self->{'Handler'}->end_prefix_mapping(@_) };
        if ($@) {
            die $@;
        }
        else {
            $self->{Methods}->{'end_prefix_mapping'} = sub { $self->{'Handler'}->end_prefix_mapping(@_) };
        }
    }
   else {
       $self->{Methods}->{'end_prefix_mapping'} = sub { $self->no_op };
   }

}

sub end_dtd {
    my $self = shift;
    my $method;
    if (defined $self->{Methods}->{'end_dtd'}) {
        $self->{Methods}->{'end_dtd'}->(@_);
    }
    elsif (defined $self->{'LexicalHandler'} and $method = $self->{'LexicalHandler'}->can('end_dtd') ) {
        $self->{Methods}->{'end_dtd'} = sub { $self->{LexicalHandler}->end_dtd(@_) };
        $method->($self->{LexicalHandler}, @_);
    }
    elsif (defined $self->{'Handler'} and $method = $self->{'Handler'}->can('end_dtd') ) {
        $self->{Methods}->{'end_dtd'} = sub { $self->{Handler}->end_dtd(@_) };
        $method->($self->{Handler}, @_);
    }
    elsif (defined $self->{'LexicalHandler'} and $self->{'LexicalHandler'}->can('AUTOLOAD') ) {
        eval { $self->{'LexicalHandler'}->end_dtd(@_) };
        if ($@) {
            die $@;
        }
        else {
            $self->{Methods}->{'end_dtd'} = sub { $self->{'LexicalHandler'}->end_dtd(@_) };
        }
    }
    elsif (defined $self->{'Handler'} and $self->{'Handler'}->can('AUTOLOAD') ) {
        eval { $self->{'Handler'}->end_dtd(@_) };
        if ($@) {
            die $@;
        }
        else {
            $self->{Methods}->{'end_dtd'} = sub { $self->{'Handler'}->end_dtd(@_) };
        }
    }
   else {
       $self->{Methods}->{'end_dtd'} = sub { $self->no_op };
   }

}

sub characters {
    my $self = shift;
    my $method;
    if (defined $self->{Methods}->{'characters'}) {
        $self->{Methods}->{'characters'}->(@_);
    }
    elsif (defined $self->{'ContentHandler'} and $method = $self->{'ContentHandler'}->can('characters') ) {
        $self->{Methods}->{'characters'} = sub { $self->{ContentHandler}->characters(@_) };
        $method->($self->{ContentHandler}, @_);
    }
    elsif (defined $self->{'DocumentHandler'} and $method = $self->{'DocumentHandler'}->can('characters') ) {
        $self->{Methods}->{'characters'} = sub { $self->{DocumentHandler}->characters(@_) };
        $method->($self->{DocumentHandler}, @_);
    }
    elsif (defined $self->{'Handler'} and $method = $self->{'Handler'}->can('characters') ) {
        $self->{Methods}->{'characters'} = sub { $self->{Handler}->characters(@_) };
        $method->($self->{Handler}, @_);
    }
    elsif (defined $self->{'ContentHandler'} and $self->{'ContentHandler'}->can('AUTOLOAD') ) {
        eval { $self->{'ContentHandler'}->characters(@_) };
        if ($@) {
            die $@;
        }
        else {
            $self->{Methods}->{'characters'} = sub { $self->{'ContentHandler'}->characters(@_) };
        }
    }
    elsif (defined $self->{'DocumentHandler'} and $self->{'DocumentHandler'}->can('AUTOLOAD') ) {
        eval { $self->{'DocumentHandler'}->characters(@_) };
        if ($@) {
            die $@;
        }
        else {
            $self->{Methods}->{'characters'} = sub { $self->{'DocumentHandler'}->characters(@_) };
        }
    }
    elsif (defined $self->{'Handler'} and $self->{'Handler'}->can('AUTOLOAD') ) {
        eval { $self->{'Handler'}->characters(@_) };
        if ($@) {
            die $@;
        }
        else {
            $self->{Methods}->{'characters'} = sub { $self->{'Handler'}->characters(@_) };
        }
    }
   else {
       $self->{Methods}->{'characters'} = sub { $self->no_op };
   }

}

sub end_cdata {
    my $self = shift;
    my $method;
    if (defined $self->{Methods}->{'end_cdata'}) {
        $self->{Methods}->{'end_cdata'}->(@_);
    }
    elsif (defined $self->{'DocumentHandler'} and $method = $self->{'DocumentHandler'}->can('end_cdata') ) {
        $self->{Methods}->{'end_cdata'} = sub { $self->{DocumentHandler}->end_cdata(@_) };
        $method->($self->{DocumentHandler}, @_);
    }
    elsif (defined $self->{'LexicalHandler'} and $method = $self->{'LexicalHandler'}->can('end_cdata') ) {
        $self->{Methods}->{'end_cdata'} = sub { $self->{LexicalHandler}->end_cdata(@_) };
        $method->($self->{LexicalHandler}, @_);
    }
    elsif (defined $self->{'Handler'} and $method = $self->{'Handler'}->can('end_cdata') ) {
        $self->{Methods}->{'end_cdata'} = sub { $self->{Handler}->end_cdata(@_) };
        $method->($self->{Handler}, @_);
    }
    elsif (defined $self->{'DocumentHandler'} and $self->{'DocumentHandler'}->can('AUTOLOAD') ) {
        eval { $self->{'DocumentHandler'}->end_cdata(@_) };
        if ($@) {
            die $@;
        }
        else {
            $self->{Methods}->{'end_cdata'} = sub { $self->{'DocumentHandler'}->end_cdata(@_) };
        }
    }
    elsif (defined $self->{'LexicalHandler'} and $self->{'LexicalHandler'}->can('AUTOLOAD') ) {
        eval { $self->{'LexicalHandler'}->end_cdata(@_) };
        if ($@) {
            die $@;
        }
        else {
            $self->{Methods}->{'end_cdata'} = sub { $self->{'LexicalHandler'}->end_cdata(@_) };
        }
    }
    elsif (defined $self->{'Handler'} and $self->{'Handler'}->can('AUTOLOAD') ) {
        eval { $self->{'Handler'}->end_cdata(@_) };
        if ($@) {
            die $@;
        }
        else {
            $self->{Methods}->{'end_cdata'} = sub { $self->{'Handler'}->end_cdata(@_) };
        }
    }
   else {
       $self->{Methods}->{'end_cdata'} = sub { $self->no_op };
   }

}

sub skipped_entity {
    my $self = shift;
    my $method;
    if (defined $self->{Methods}->{'skipped_entity'}) {
        $self->{Methods}->{'skipped_entity'}->(@_);
    }
    elsif (defined $self->{'ContentHandler'} and $method = $self->{'ContentHandler'}->can('skipped_entity') ) {
        $self->{Methods}->{'skipped_entity'} = sub { $self->{ContentHandler}->skipped_entity(@_) };
        $method->($self->{ContentHandler}, @_);
    }
    elsif (defined $self->{'Handler'} and $method = $self->{'Handler'}->can('skipped_entity') ) {
        $self->{Methods}->{'skipped_entity'} = sub { $self->{Handler}->skipped_entity(@_) };
        $method->($self->{Handler}, @_);
    }
    elsif (defined $self->{'ContentHandler'} and $self->{'ContentHandler'}->can('AUTOLOAD') ) {
        eval { $self->{'ContentHandler'}->skipped_entity(@_) };
        if ($@) {
            die $@;
        }
        else {
            $self->{Methods}->{'skipped_entity'} = sub { $self->{'ContentHandler'}->skipped_entity(@_) };
        }
    }
    elsif (defined $self->{'Handler'} and $self->{'Handler'}->can('AUTOLOAD') ) {
        eval { $self->{'Handler'}->skipped_entity(@_) };
        if ($@) {
            die $@;
        }
        else {
            $self->{Methods}->{'skipped_entity'} = sub { $self->{'Handler'}->skipped_entity(@_) };
        }
    }
   else {
       $self->{Methods}->{'skipped_entity'} = sub { $self->no_op };
   }

}

sub ignorable_whitespace {
    my $self = shift;
    my $method;
    if (defined $self->{Methods}->{'ignorable_whitespace'}) {
        $self->{Methods}->{'ignorable_whitespace'}->(@_);
    }
    elsif (defined $self->{'ContentHandler'} and $method = $self->{'ContentHandler'}->can('ignorable_whitespace') ) {
        $self->{Methods}->{'ignorable_whitespace'} = sub { $self->{ContentHandler}->ignorable_whitespace(@_) };
        $method->($self->{ContentHandler}, @_);
    }
    elsif (defined $self->{'DocumentHandler'} and $method = $self->{'DocumentHandler'}->can('ignorable_whitespace') ) {
        $self->{Methods}->{'ignorable_whitespace'} = sub { $self->{DocumentHandler}->ignorable_whitespace(@_) };
        $method->($self->{DocumentHandler}, @_);
    }
    elsif (defined $self->{'Handler'} and $method = $self->{'Handler'}->can('ignorable_whitespace') ) {
        $self->{Methods}->{'ignorable_whitespace'} = sub { $self->{Handler}->ignorable_whitespace(@_) };
        $method->($self->{Handler}, @_);
    }
    elsif (defined $self->{'ContentHandler'} and $self->{'ContentHandler'}->can('AUTOLOAD') ) {
        eval { $self->{'ContentHandler'}->ignorable_whitespace(@_) };
        if ($@) {
            die $@;
        }
        else {
            $self->{Methods}->{'ignorable_whitespace'} = sub { $self->{'ContentHandler'}->ignorable_whitespace(@_) };
        }
    }
    elsif (defined $self->{'DocumentHandler'} and $self->{'DocumentHandler'}->can('AUTOLOAD') ) {
        eval { $self->{'DocumentHandler'}->ignorable_whitespace(@_) };
        if ($@) {
            die $@;
        }
        else {
            $self->{Methods}->{'ignorable_whitespace'} = sub { $self->{'DocumentHandler'}->ignorable_whitespace(@_) };
        }
    }
    elsif (defined $self->{'Handler'} and $self->{'Handler'}->can('AUTOLOAD') ) {
        eval { $self->{'Handler'}->ignorable_whitespace(@_) };
        if ($@) {
            die $@;
        }
        else {
            $self->{Methods}->{'ignorable_whitespace'} = sub { $self->{'Handler'}->ignorable_whitespace(@_) };
        }
    }
   else {
       $self->{Methods}->{'ignorable_whitespace'} = sub { $self->no_op };
   }

}

sub internal_entity_decl {
    my $self = shift;
    my $method;
    if (defined $self->{Methods}->{'internal_entity_decl'}) {
        $self->{Methods}->{'internal_entity_decl'}->(@_);
    }
    elsif (defined $self->{'DeclHandler'} and $method = $self->{'DeclHandler'}->can('internal_entity_decl') ) {
        $self->{Methods}->{'internal_entity_decl'} = sub { $self->{DeclHandler}->internal_entity_decl(@_) };
        $method->($self->{DeclHandler}, @_);
    }
    elsif (defined $self->{'Handler'} and $method = $self->{'Handler'}->can('internal_entity_decl') ) {
        $self->{Methods}->{'internal_entity_decl'} = sub { $self->{Handler}->internal_entity_decl(@_) };
        $method->($self->{Handler}, @_);
    }
    elsif (defined $self->{'DeclHandler'} and $self->{'DeclHandler'}->can('AUTOLOAD') ) {
        eval { $self->{'DeclHandler'}->internal_entity_decl(@_) };
        if ($@) {
            die $@;
        }
        else {
            $self->{Methods}->{'internal_entity_decl'} = sub { $self->{'DeclHandler'}->internal_entity_decl(@_) };
        }
    }
    elsif (defined $self->{'Handler'} and $self->{'Handler'}->can('AUTOLOAD') ) {
        eval { $self->{'Handler'}->internal_entity_decl(@_) };
        if ($@) {
            die $@;
        }
        else {
            $self->{Methods}->{'internal_entity_decl'} = sub { $self->{'Handler'}->internal_entity_decl(@_) };
        }
    }
   else {
       $self->{Methods}->{'internal_entity_decl'} = sub { $self->no_op };
   }

}

sub start_entity {
    my $self = shift;
    my $method;
    if (defined $self->{Methods}->{'start_entity'}) {
        $self->{Methods}->{'start_entity'}->(@_);
    }
    elsif (defined $self->{'LexicalHandler'} and $method = $self->{'LexicalHandler'}->can('start_entity') ) {
        $self->{Methods}->{'start_entity'} = sub { $self->{LexicalHandler}->start_entity(@_) };
        $method->($self->{LexicalHandler}, @_);
    }
    elsif (defined $self->{'Handler'} and $method = $self->{'Handler'}->can('start_entity') ) {
        $self->{Methods}->{'start_entity'} = sub { $self->{Handler}->start_entity(@_) };
        $method->($self->{Handler}, @_);
    }
    elsif (defined $self->{'LexicalHandler'} and $self->{'LexicalHandler'}->can('AUTOLOAD') ) {
        eval { $self->{'LexicalHandler'}->start_entity(@_) };
        if ($@) {
            die $@;
        }
        else {
            $self->{Methods}->{'start_entity'} = sub { $self->{'LexicalHandler'}->start_entity(@_) };
        }
    }
    elsif (defined $self->{'Handler'} and $self->{'Handler'}->can('AUTOLOAD') ) {
        eval { $self->{'Handler'}->start_entity(@_) };
        if ($@) {
            die $@;
        }
        else {
            $self->{Methods}->{'start_entity'} = sub { $self->{'Handler'}->start_entity(@_) };
        }
    }
   else {
       $self->{Methods}->{'start_entity'} = sub { $self->no_op };
   }

}

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

    $options->{Handler} ||= XML::SAX::Base::NoHandler->new;
    return bless $options, $class;
}
#-------------------------------------------------------------------#

#-------------------------------------------------------------------#
# $p->parse(%options)
#-------------------------------------------------------------------#
sub parse {
    my $self = shift;
    my $parse_options = $self->get_options(@_);
    if ($self->{Parent}) { # calling parse on a filter for some reason
        return $self->{Parent}->parse($parse_options);
    }
    else {
        if (defined $parse_options->{Source}{CharacterStream} && $self->can('_parse_characterstream')) {
            return $self->_parse_characterstream(
                    $parse_options->{Source}{CharacterStream}, $parse_options);
        }
        elsif (defined $parse_options->{Source}{ByteStream} && $self->can('_parse_characterstream')) {
            return $self->_parse_bytestream(
                    $parse_options->{Source}{ByteStream}, $parse_options);
        }
        elsif (defined $parse_options->{Source}{String} && $self->can('_parse_string')) {
            return $self->_parse_string(
                    $parse_options->{Source}{String}, $parse_options);
        }
        elsif (defined $parse_options->{Source}{SystemId} && $self->can('_parse_systemid')) {
            return $self->_parse_systemid(
                    $parse_options->{Source}{SystemId}, $parse_options);
        }
        else {
            die "No _parse_* routine defined on this driver (if it a filter, remember to set the Parent property) [$self]";
        }
    }
}
#-------------------------------------------------------------------#

#-------------------------------------------------------------------#
# $p->parse_file(%options)
#-------------------------------------------------------------------#
sub parse_file {
    my $self = shift;
    my $file = shift;
    my $parse_options = $self->get_options(@_);
    $parse_options->{Source}{ByteStream} = $file;
    return $self->parse($parse_options);
}
#-------------------------------------------------------------------#

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

#-------------------------------------------------------------------#
# $p->parse_string(%options)
#-------------------------------------------------------------------#
sub parse_string {
    my $self = shift;
    my $string = shift;
    my $parse_options = $self->get_options(@_);
    $parse_options->{Source}{String} = $string;
    return $self->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'     => undef,
    'http://xml.org/sax/features/external-parameter-entities'   => undef,
    'http://xml.org/sax/features/is-standalone'                 => undef,
    'http://xml.org/sax/features/lexical-handler'               => undef,
    'http://xml.org/sax/features/parameter-entities'            => undef,
    'http://xml.org/sax/features/namespaces'                    => 1,
    'http://xml.org/sax/features/namespace-prefixes'            => 0,
    'http://xml.org/sax/features/string-interning'              => undef,
    'http://xml.org/sax/features/use-attributes2'               => undef,
    'http://xml.org/sax/features/use-locator2'                  => undef,
    'http://xml.org/sax/features/validation'                    => undef,

    'http://xml.org/sax/properties/dom-node'                    => undef,
    'http://xml.org/sax/properties/xml-string'                  => 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
}
#-------------------------------------------------------------------#

#-------------------------------------------------------------------#
# 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
}
#-------------------------------------------------------------------#

#-------------------------------------------------------------------#
# 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;

# 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 {
    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<NOT> 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->{Handler}->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->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&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->{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->SUPER::get_feature($feat);
      }
  }

Currently this part is unimplemented.

=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<XML::SAX>

=cut

