1 package XML::SAX::Base;
3 # version 0.10 - Kip Hampton <khampton@totalcinema.com>
4 # version 0.13 - Robin Berjon <robin@knowscape.com>
5 # version 0.15 - Kip Hampton <khampton@totalcinema.com>
6 # version 0.17 - Kip Hampton <khampton@totalcinema.com>
7 # version 0.19 - Kip Hampton <khampton@totalcinema.com>
8 # version 0.21 - Kip Hampton <khampton@totalcinema.com>
9 # version 0.22 - Robin Berjon <robin@knowscape.com>
10 # version 0.23 - Matt Sergeant <matt@sergeant.org>
11 # version 0.24 - Robin Berjon <robin@knowscape.com>
12 # version 0.25 - Kip Hampton <khampton@totalcinema.com>
13 # version 1.00 - Kip Hampton <khampton@totalcinema.com>
14 # version 1.01 - Kip Hampton <khampton@totalcinema.com>
15 # version 1.02 - Robin Berjon <robin@knowscape.com>
16 # version 1.03 - Matt Sergeant <matt@sergeant.org>
17 # version 1.04 - Kip Hampton <khampton@totalcinema.com>
19 #-----------------------------------------------------#
22 # This file is generated by the 'Makefile.PL' file
23 # that ships with the XML::SAX distribution.
24 # If you need to make changes, patch that file NOT
26 #-----------------------------------------------------#
29 use vars qw($VERSION);
30 use XML::SAX::Exception qw();
34 sub end_prefix_mapping {
36 if (defined $self->{Methods}->{'end_prefix_mapping'}) {
37 $self->{Methods}->{'end_prefix_mapping'}->(@_);
42 if (exists $self->{ParseOptions}) {
43 $callbacks = $self->{ParseOptions};
48 if (0) { # dummy to make elsif's below compile
50 elsif (defined $callbacks->{'ContentHandler'} and $method = $callbacks->{'ContentHandler'}->can('end_prefix_mapping') ) {
51 my $handler = $callbacks->{'ContentHandler'};
52 $self->{Methods}->{'end_prefix_mapping'} = sub { $method->($handler, @_) };
53 return $method->($handler, @_);
55 elsif (defined $callbacks->{'Handler'} and $method = $callbacks->{'Handler'}->can('end_prefix_mapping') ) {
56 my $handler = $callbacks->{'Handler'};
57 $self->{Methods}->{'end_prefix_mapping'} = sub { $method->($handler, @_) };
58 return $method->($handler, @_);
60 elsif (defined $callbacks->{'ContentHandler'}
61 and $callbacks->{'ContentHandler'}->can('AUTOLOAD')
62 and $callbacks->{'ContentHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
65 my $res = eval { $callbacks->{'ContentHandler'}->end_prefix_mapping(@_) };
70 # I think there's a buggette here...
71 # if the first call throws an exception, we don't set it up right.
72 # Not fatal, but we might want to address it.
73 my $handler = $callbacks->{'ContentHandler'};
74 $self->{Methods}->{'end_prefix_mapping'} = sub { $handler->end_prefix_mapping(@_) };
78 elsif (defined $callbacks->{'Handler'}
79 and $callbacks->{'Handler'}->can('AUTOLOAD')
80 and $callbacks->{'Handler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
83 my $res = eval { $callbacks->{'Handler'}->end_prefix_mapping(@_) };
88 # I think there's a buggette here...
89 # if the first call throws an exception, we don't set it up right.
90 # Not fatal, but we might want to address it.
91 my $handler = $callbacks->{'Handler'};
92 $self->{Methods}->{'end_prefix_mapping'} = sub { $handler->end_prefix_mapping(@_) };
97 $self->{Methods}->{'end_prefix_mapping'} = sub { };
103 sub internal_entity_decl {
105 if (defined $self->{Methods}->{'internal_entity_decl'}) {
106 $self->{Methods}->{'internal_entity_decl'}->(@_);
111 if (exists $self->{ParseOptions}) {
112 $callbacks = $self->{ParseOptions};
117 if (0) { # dummy to make elsif's below compile
119 elsif (defined $callbacks->{'DeclHandler'} and $method = $callbacks->{'DeclHandler'}->can('internal_entity_decl') ) {
120 my $handler = $callbacks->{'DeclHandler'};
121 $self->{Methods}->{'internal_entity_decl'} = sub { $method->($handler, @_) };
122 return $method->($handler, @_);
124 elsif (defined $callbacks->{'Handler'} and $method = $callbacks->{'Handler'}->can('internal_entity_decl') ) {
125 my $handler = $callbacks->{'Handler'};
126 $self->{Methods}->{'internal_entity_decl'} = sub { $method->($handler, @_) };
127 return $method->($handler, @_);
129 elsif (defined $callbacks->{'DeclHandler'}
130 and $callbacks->{'DeclHandler'}->can('AUTOLOAD')
131 and $callbacks->{'DeclHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
134 my $res = eval { $callbacks->{'DeclHandler'}->internal_entity_decl(@_) };
139 # I think there's a buggette here...
140 # if the first call throws an exception, we don't set it up right.
141 # Not fatal, but we might want to address it.
142 my $handler = $callbacks->{'DeclHandler'};
143 $self->{Methods}->{'internal_entity_decl'} = sub { $handler->internal_entity_decl(@_) };
147 elsif (defined $callbacks->{'Handler'}
148 and $callbacks->{'Handler'}->can('AUTOLOAD')
149 and $callbacks->{'Handler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
152 my $res = eval { $callbacks->{'Handler'}->internal_entity_decl(@_) };
157 # I think there's a buggette here...
158 # if the first call throws an exception, we don't set it up right.
159 # Not fatal, but we might want to address it.
160 my $handler = $callbacks->{'Handler'};
161 $self->{Methods}->{'internal_entity_decl'} = sub { $handler->internal_entity_decl(@_) };
166 $self->{Methods}->{'internal_entity_decl'} = sub { };
174 if (defined $self->{Methods}->{'characters'}) {
175 $self->{Methods}->{'characters'}->(@_);
180 if (exists $self->{ParseOptions}) {
181 $callbacks = $self->{ParseOptions};
186 if (0) { # dummy to make elsif's below compile
188 elsif (defined $callbacks->{'ContentHandler'} and $method = $callbacks->{'ContentHandler'}->can('characters') ) {
189 my $handler = $callbacks->{'ContentHandler'};
190 $self->{Methods}->{'characters'} = sub { $method->($handler, @_) };
191 return $method->($handler, @_);
193 elsif (defined $callbacks->{'DocumentHandler'} and $method = $callbacks->{'DocumentHandler'}->can('characters') ) {
194 my $handler = $callbacks->{'DocumentHandler'};
195 $self->{Methods}->{'characters'} = sub { $method->($handler, @_) };
196 return $method->($handler, @_);
198 elsif (defined $callbacks->{'Handler'} and $method = $callbacks->{'Handler'}->can('characters') ) {
199 my $handler = $callbacks->{'Handler'};
200 $self->{Methods}->{'characters'} = sub { $method->($handler, @_) };
201 return $method->($handler, @_);
203 elsif (defined $callbacks->{'ContentHandler'}
204 and $callbacks->{'ContentHandler'}->can('AUTOLOAD')
205 and $callbacks->{'ContentHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
208 my $res = eval { $callbacks->{'ContentHandler'}->characters(@_) };
213 # I think there's a buggette here...
214 # if the first call throws an exception, we don't set it up right.
215 # Not fatal, but we might want to address it.
216 my $handler = $callbacks->{'ContentHandler'};
217 $self->{Methods}->{'characters'} = sub { $handler->characters(@_) };
221 elsif (defined $callbacks->{'DocumentHandler'}
222 and $callbacks->{'DocumentHandler'}->can('AUTOLOAD')
223 and $callbacks->{'DocumentHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
226 my $res = eval { $callbacks->{'DocumentHandler'}->characters(@_) };
231 # I think there's a buggette here...
232 # if the first call throws an exception, we don't set it up right.
233 # Not fatal, but we might want to address it.
234 my $handler = $callbacks->{'DocumentHandler'};
235 $self->{Methods}->{'characters'} = sub { $handler->characters(@_) };
239 elsif (defined $callbacks->{'Handler'}
240 and $callbacks->{'Handler'}->can('AUTOLOAD')
241 and $callbacks->{'Handler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
244 my $res = eval { $callbacks->{'Handler'}->characters(@_) };
249 # I think there's a buggette here...
250 # if the first call throws an exception, we don't set it up right.
251 # Not fatal, but we might want to address it.
252 my $handler = $callbacks->{'Handler'};
253 $self->{Methods}->{'characters'} = sub { $handler->characters(@_) };
258 $self->{Methods}->{'characters'} = sub { };
266 if (defined $self->{Methods}->{'start_element'}) {
267 $self->{Methods}->{'start_element'}->(@_);
272 if (exists $self->{ParseOptions}) {
273 $callbacks = $self->{ParseOptions};
278 if (0) { # dummy to make elsif's below compile
280 elsif (defined $callbacks->{'ContentHandler'} and $method = $callbacks->{'ContentHandler'}->can('start_element') ) {
281 my $handler = $callbacks->{'ContentHandler'};
282 $self->{Methods}->{'start_element'} = sub { $method->($handler, @_) };
283 return $method->($handler, @_);
285 elsif (defined $callbacks->{'DocumentHandler'} and $method = $callbacks->{'DocumentHandler'}->can('start_element') ) {
286 my $handler = $callbacks->{'DocumentHandler'};
287 $self->{Methods}->{'start_element'} = sub { $method->($handler, @_) };
288 return $method->($handler, @_);
290 elsif (defined $callbacks->{'Handler'} and $method = $callbacks->{'Handler'}->can('start_element') ) {
291 my $handler = $callbacks->{'Handler'};
292 $self->{Methods}->{'start_element'} = sub { $method->($handler, @_) };
293 return $method->($handler, @_);
295 elsif (defined $callbacks->{'ContentHandler'}
296 and $callbacks->{'ContentHandler'}->can('AUTOLOAD')
297 and $callbacks->{'ContentHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
300 my $res = eval { $callbacks->{'ContentHandler'}->start_element(@_) };
305 # I think there's a buggette here...
306 # if the first call throws an exception, we don't set it up right.
307 # Not fatal, but we might want to address it.
308 my $handler = $callbacks->{'ContentHandler'};
309 $self->{Methods}->{'start_element'} = sub { $handler->start_element(@_) };
313 elsif (defined $callbacks->{'DocumentHandler'}
314 and $callbacks->{'DocumentHandler'}->can('AUTOLOAD')
315 and $callbacks->{'DocumentHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
318 my $res = eval { $callbacks->{'DocumentHandler'}->start_element(@_) };
323 # I think there's a buggette here...
324 # if the first call throws an exception, we don't set it up right.
325 # Not fatal, but we might want to address it.
326 my $handler = $callbacks->{'DocumentHandler'};
327 $self->{Methods}->{'start_element'} = sub { $handler->start_element(@_) };
331 elsif (defined $callbacks->{'Handler'}
332 and $callbacks->{'Handler'}->can('AUTOLOAD')
333 and $callbacks->{'Handler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
336 my $res = eval { $callbacks->{'Handler'}->start_element(@_) };
341 # I think there's a buggette here...
342 # if the first call throws an exception, we don't set it up right.
343 # Not fatal, but we might want to address it.
344 my $handler = $callbacks->{'Handler'};
345 $self->{Methods}->{'start_element'} = sub { $handler->start_element(@_) };
350 $self->{Methods}->{'start_element'} = sub { };
356 sub external_entity_decl {
358 if (defined $self->{Methods}->{'external_entity_decl'}) {
359 $self->{Methods}->{'external_entity_decl'}->(@_);
364 if (exists $self->{ParseOptions}) {
365 $callbacks = $self->{ParseOptions};
370 if (0) { # dummy to make elsif's below compile
372 elsif (defined $callbacks->{'DeclHandler'} and $method = $callbacks->{'DeclHandler'}->can('external_entity_decl') ) {
373 my $handler = $callbacks->{'DeclHandler'};
374 $self->{Methods}->{'external_entity_decl'} = sub { $method->($handler, @_) };
375 return $method->($handler, @_);
377 elsif (defined $callbacks->{'Handler'} and $method = $callbacks->{'Handler'}->can('external_entity_decl') ) {
378 my $handler = $callbacks->{'Handler'};
379 $self->{Methods}->{'external_entity_decl'} = sub { $method->($handler, @_) };
380 return $method->($handler, @_);
382 elsif (defined $callbacks->{'DeclHandler'}
383 and $callbacks->{'DeclHandler'}->can('AUTOLOAD')
384 and $callbacks->{'DeclHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
387 my $res = eval { $callbacks->{'DeclHandler'}->external_entity_decl(@_) };
392 # I think there's a buggette here...
393 # if the first call throws an exception, we don't set it up right.
394 # Not fatal, but we might want to address it.
395 my $handler = $callbacks->{'DeclHandler'};
396 $self->{Methods}->{'external_entity_decl'} = sub { $handler->external_entity_decl(@_) };
400 elsif (defined $callbacks->{'Handler'}
401 and $callbacks->{'Handler'}->can('AUTOLOAD')
402 and $callbacks->{'Handler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
405 my $res = eval { $callbacks->{'Handler'}->external_entity_decl(@_) };
410 # I think there's a buggette here...
411 # if the first call throws an exception, we don't set it up right.
412 # Not fatal, but we might want to address it.
413 my $handler = $callbacks->{'Handler'};
414 $self->{Methods}->{'external_entity_decl'} = sub { $handler->external_entity_decl(@_) };
419 $self->{Methods}->{'external_entity_decl'} = sub { };
427 if (defined $self->{Methods}->{'xml_decl'}) {
428 $self->{Methods}->{'xml_decl'}->(@_);
433 if (exists $self->{ParseOptions}) {
434 $callbacks = $self->{ParseOptions};
439 if (0) { # dummy to make elsif's below compile
441 elsif (defined $callbacks->{'DTDHandler'} and $method = $callbacks->{'DTDHandler'}->can('xml_decl') ) {
442 my $handler = $callbacks->{'DTDHandler'};
443 $self->{Methods}->{'xml_decl'} = sub { $method->($handler, @_) };
444 return $method->($handler, @_);
446 elsif (defined $callbacks->{'Handler'} and $method = $callbacks->{'Handler'}->can('xml_decl') ) {
447 my $handler = $callbacks->{'Handler'};
448 $self->{Methods}->{'xml_decl'} = sub { $method->($handler, @_) };
449 return $method->($handler, @_);
451 elsif (defined $callbacks->{'DTDHandler'}
452 and $callbacks->{'DTDHandler'}->can('AUTOLOAD')
453 and $callbacks->{'DTDHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
456 my $res = eval { $callbacks->{'DTDHandler'}->xml_decl(@_) };
461 # I think there's a buggette here...
462 # if the first call throws an exception, we don't set it up right.
463 # Not fatal, but we might want to address it.
464 my $handler = $callbacks->{'DTDHandler'};
465 $self->{Methods}->{'xml_decl'} = sub { $handler->xml_decl(@_) };
469 elsif (defined $callbacks->{'Handler'}
470 and $callbacks->{'Handler'}->can('AUTOLOAD')
471 and $callbacks->{'Handler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
474 my $res = eval { $callbacks->{'Handler'}->xml_decl(@_) };
479 # I think there's a buggette here...
480 # if the first call throws an exception, we don't set it up right.
481 # Not fatal, but we might want to address it.
482 my $handler = $callbacks->{'Handler'};
483 $self->{Methods}->{'xml_decl'} = sub { $handler->xml_decl(@_) };
488 $self->{Methods}->{'xml_decl'} = sub { };
496 if (defined $self->{Methods}->{'entity_decl'}) {
497 $self->{Methods}->{'entity_decl'}->(@_);
502 if (exists $self->{ParseOptions}) {
503 $callbacks = $self->{ParseOptions};
508 if (0) { # dummy to make elsif's below compile
510 elsif (defined $callbacks->{'DTDHandler'} and $method = $callbacks->{'DTDHandler'}->can('entity_decl') ) {
511 my $handler = $callbacks->{'DTDHandler'};
512 $self->{Methods}->{'entity_decl'} = sub { $method->($handler, @_) };
513 return $method->($handler, @_);
515 elsif (defined $callbacks->{'Handler'} and $method = $callbacks->{'Handler'}->can('entity_decl') ) {
516 my $handler = $callbacks->{'Handler'};
517 $self->{Methods}->{'entity_decl'} = sub { $method->($handler, @_) };
518 return $method->($handler, @_);
520 elsif (defined $callbacks->{'DTDHandler'}
521 and $callbacks->{'DTDHandler'}->can('AUTOLOAD')
522 and $callbacks->{'DTDHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
525 my $res = eval { $callbacks->{'DTDHandler'}->entity_decl(@_) };
530 # I think there's a buggette here...
531 # if the first call throws an exception, we don't set it up right.
532 # Not fatal, but we might want to address it.
533 my $handler = $callbacks->{'DTDHandler'};
534 $self->{Methods}->{'entity_decl'} = sub { $handler->entity_decl(@_) };
538 elsif (defined $callbacks->{'Handler'}
539 and $callbacks->{'Handler'}->can('AUTOLOAD')
540 and $callbacks->{'Handler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
543 my $res = eval { $callbacks->{'Handler'}->entity_decl(@_) };
548 # I think there's a buggette here...
549 # if the first call throws an exception, we don't set it up right.
550 # Not fatal, but we might want to address it.
551 my $handler = $callbacks->{'Handler'};
552 $self->{Methods}->{'entity_decl'} = sub { $handler->entity_decl(@_) };
557 $self->{Methods}->{'entity_decl'} = sub { };
565 if (defined $self->{Methods}->{'end_dtd'}) {
566 $self->{Methods}->{'end_dtd'}->(@_);
571 if (exists $self->{ParseOptions}) {
572 $callbacks = $self->{ParseOptions};
577 if (0) { # dummy to make elsif's below compile
579 elsif (defined $callbacks->{'LexicalHandler'} and $method = $callbacks->{'LexicalHandler'}->can('end_dtd') ) {
580 my $handler = $callbacks->{'LexicalHandler'};
581 $self->{Methods}->{'end_dtd'} = sub { $method->($handler, @_) };
582 return $method->($handler, @_);
584 elsif (defined $callbacks->{'Handler'} and $method = $callbacks->{'Handler'}->can('end_dtd') ) {
585 my $handler = $callbacks->{'Handler'};
586 $self->{Methods}->{'end_dtd'} = sub { $method->($handler, @_) };
587 return $method->($handler, @_);
589 elsif (defined $callbacks->{'LexicalHandler'}
590 and $callbacks->{'LexicalHandler'}->can('AUTOLOAD')
591 and $callbacks->{'LexicalHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
594 my $res = eval { $callbacks->{'LexicalHandler'}->end_dtd(@_) };
599 # I think there's a buggette here...
600 # if the first call throws an exception, we don't set it up right.
601 # Not fatal, but we might want to address it.
602 my $handler = $callbacks->{'LexicalHandler'};
603 $self->{Methods}->{'end_dtd'} = sub { $handler->end_dtd(@_) };
607 elsif (defined $callbacks->{'Handler'}
608 and $callbacks->{'Handler'}->can('AUTOLOAD')
609 and $callbacks->{'Handler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
612 my $res = eval { $callbacks->{'Handler'}->end_dtd(@_) };
617 # I think there's a buggette here...
618 # if the first call throws an exception, we don't set it up right.
619 # Not fatal, but we might want to address it.
620 my $handler = $callbacks->{'Handler'};
621 $self->{Methods}->{'end_dtd'} = sub { $handler->end_dtd(@_) };
626 $self->{Methods}->{'end_dtd'} = sub { };
632 sub unparsed_entity_decl {
634 if (defined $self->{Methods}->{'unparsed_entity_decl'}) {
635 $self->{Methods}->{'unparsed_entity_decl'}->(@_);
640 if (exists $self->{ParseOptions}) {
641 $callbacks = $self->{ParseOptions};
646 if (0) { # dummy to make elsif's below compile
648 elsif (defined $callbacks->{'DTDHandler'} and $method = $callbacks->{'DTDHandler'}->can('unparsed_entity_decl') ) {
649 my $handler = $callbacks->{'DTDHandler'};
650 $self->{Methods}->{'unparsed_entity_decl'} = sub { $method->($handler, @_) };
651 return $method->($handler, @_);
653 elsif (defined $callbacks->{'Handler'} and $method = $callbacks->{'Handler'}->can('unparsed_entity_decl') ) {
654 my $handler = $callbacks->{'Handler'};
655 $self->{Methods}->{'unparsed_entity_decl'} = sub { $method->($handler, @_) };
656 return $method->($handler, @_);
658 elsif (defined $callbacks->{'DTDHandler'}
659 and $callbacks->{'DTDHandler'}->can('AUTOLOAD')
660 and $callbacks->{'DTDHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
663 my $res = eval { $callbacks->{'DTDHandler'}->unparsed_entity_decl(@_) };
668 # I think there's a buggette here...
669 # if the first call throws an exception, we don't set it up right.
670 # Not fatal, but we might want to address it.
671 my $handler = $callbacks->{'DTDHandler'};
672 $self->{Methods}->{'unparsed_entity_decl'} = sub { $handler->unparsed_entity_decl(@_) };
676 elsif (defined $callbacks->{'Handler'}
677 and $callbacks->{'Handler'}->can('AUTOLOAD')
678 and $callbacks->{'Handler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
681 my $res = eval { $callbacks->{'Handler'}->unparsed_entity_decl(@_) };
686 # I think there's a buggette here...
687 # if the first call throws an exception, we don't set it up right.
688 # Not fatal, but we might want to address it.
689 my $handler = $callbacks->{'Handler'};
690 $self->{Methods}->{'unparsed_entity_decl'} = sub { $handler->unparsed_entity_decl(@_) };
695 $self->{Methods}->{'unparsed_entity_decl'} = sub { };
701 sub processing_instruction {
703 if (defined $self->{Methods}->{'processing_instruction'}) {
704 $self->{Methods}->{'processing_instruction'}->(@_);
709 if (exists $self->{ParseOptions}) {
710 $callbacks = $self->{ParseOptions};
715 if (0) { # dummy to make elsif's below compile
717 elsif (defined $callbacks->{'ContentHandler'} and $method = $callbacks->{'ContentHandler'}->can('processing_instruction') ) {
718 my $handler = $callbacks->{'ContentHandler'};
719 $self->{Methods}->{'processing_instruction'} = sub { $method->($handler, @_) };
720 return $method->($handler, @_);
722 elsif (defined $callbacks->{'DocumentHandler'} and $method = $callbacks->{'DocumentHandler'}->can('processing_instruction') ) {
723 my $handler = $callbacks->{'DocumentHandler'};
724 $self->{Methods}->{'processing_instruction'} = sub { $method->($handler, @_) };
725 return $method->($handler, @_);
727 elsif (defined $callbacks->{'Handler'} and $method = $callbacks->{'Handler'}->can('processing_instruction') ) {
728 my $handler = $callbacks->{'Handler'};
729 $self->{Methods}->{'processing_instruction'} = sub { $method->($handler, @_) };
730 return $method->($handler, @_);
732 elsif (defined $callbacks->{'ContentHandler'}
733 and $callbacks->{'ContentHandler'}->can('AUTOLOAD')
734 and $callbacks->{'ContentHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
737 my $res = eval { $callbacks->{'ContentHandler'}->processing_instruction(@_) };
742 # I think there's a buggette here...
743 # if the first call throws an exception, we don't set it up right.
744 # Not fatal, but we might want to address it.
745 my $handler = $callbacks->{'ContentHandler'};
746 $self->{Methods}->{'processing_instruction'} = sub { $handler->processing_instruction(@_) };
750 elsif (defined $callbacks->{'DocumentHandler'}
751 and $callbacks->{'DocumentHandler'}->can('AUTOLOAD')
752 and $callbacks->{'DocumentHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
755 my $res = eval { $callbacks->{'DocumentHandler'}->processing_instruction(@_) };
760 # I think there's a buggette here...
761 # if the first call throws an exception, we don't set it up right.
762 # Not fatal, but we might want to address it.
763 my $handler = $callbacks->{'DocumentHandler'};
764 $self->{Methods}->{'processing_instruction'} = sub { $handler->processing_instruction(@_) };
768 elsif (defined $callbacks->{'Handler'}
769 and $callbacks->{'Handler'}->can('AUTOLOAD')
770 and $callbacks->{'Handler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
773 my $res = eval { $callbacks->{'Handler'}->processing_instruction(@_) };
778 # I think there's a buggette here...
779 # if the first call throws an exception, we don't set it up right.
780 # Not fatal, but we might want to address it.
781 my $handler = $callbacks->{'Handler'};
782 $self->{Methods}->{'processing_instruction'} = sub { $handler->processing_instruction(@_) };
787 $self->{Methods}->{'processing_instruction'} = sub { };
795 if (defined $self->{Methods}->{'attribute_decl'}) {
796 $self->{Methods}->{'attribute_decl'}->(@_);
801 if (exists $self->{ParseOptions}) {
802 $callbacks = $self->{ParseOptions};
807 if (0) { # dummy to make elsif's below compile
809 elsif (defined $callbacks->{'DeclHandler'} and $method = $callbacks->{'DeclHandler'}->can('attribute_decl') ) {
810 my $handler = $callbacks->{'DeclHandler'};
811 $self->{Methods}->{'attribute_decl'} = sub { $method->($handler, @_) };
812 return $method->($handler, @_);
814 elsif (defined $callbacks->{'Handler'} and $method = $callbacks->{'Handler'}->can('attribute_decl') ) {
815 my $handler = $callbacks->{'Handler'};
816 $self->{Methods}->{'attribute_decl'} = sub { $method->($handler, @_) };
817 return $method->($handler, @_);
819 elsif (defined $callbacks->{'DeclHandler'}
820 and $callbacks->{'DeclHandler'}->can('AUTOLOAD')
821 and $callbacks->{'DeclHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
824 my $res = eval { $callbacks->{'DeclHandler'}->attribute_decl(@_) };
829 # I think there's a buggette here...
830 # if the first call throws an exception, we don't set it up right.
831 # Not fatal, but we might want to address it.
832 my $handler = $callbacks->{'DeclHandler'};
833 $self->{Methods}->{'attribute_decl'} = sub { $handler->attribute_decl(@_) };
837 elsif (defined $callbacks->{'Handler'}
838 and $callbacks->{'Handler'}->can('AUTOLOAD')
839 and $callbacks->{'Handler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
842 my $res = eval { $callbacks->{'Handler'}->attribute_decl(@_) };
847 # I think there's a buggette here...
848 # if the first call throws an exception, we don't set it up right.
849 # Not fatal, but we might want to address it.
850 my $handler = $callbacks->{'Handler'};
851 $self->{Methods}->{'attribute_decl'} = sub { $handler->attribute_decl(@_) };
856 $self->{Methods}->{'attribute_decl'} = sub { };
864 if (defined $self->{Methods}->{'fatal_error'}) {
865 $self->{Methods}->{'fatal_error'}->(@_);
870 if (exists $self->{ParseOptions}) {
871 $callbacks = $self->{ParseOptions};
876 if (0) { # dummy to make elsif's below compile
878 elsif (defined $callbacks->{'ErrorHandler'} and $method = $callbacks->{'ErrorHandler'}->can('fatal_error') ) {
879 my $handler = $callbacks->{'ErrorHandler'};
880 $self->{Methods}->{'fatal_error'} = sub { $method->($handler, @_) };
881 return $method->($handler, @_);
883 elsif (defined $callbacks->{'Handler'} and $method = $callbacks->{'Handler'}->can('fatal_error') ) {
884 my $handler = $callbacks->{'Handler'};
885 $self->{Methods}->{'fatal_error'} = sub { $method->($handler, @_) };
886 return $method->($handler, @_);
888 elsif (defined $callbacks->{'ErrorHandler'}
889 and $callbacks->{'ErrorHandler'}->can('AUTOLOAD')
890 and $callbacks->{'ErrorHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
893 my $res = eval { $callbacks->{'ErrorHandler'}->fatal_error(@_) };
898 # I think there's a buggette here...
899 # if the first call throws an exception, we don't set it up right.
900 # Not fatal, but we might want to address it.
901 my $handler = $callbacks->{'ErrorHandler'};
902 $self->{Methods}->{'fatal_error'} = sub { $handler->fatal_error(@_) };
906 elsif (defined $callbacks->{'Handler'}
907 and $callbacks->{'Handler'}->can('AUTOLOAD')
908 and $callbacks->{'Handler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
911 my $res = eval { $callbacks->{'Handler'}->fatal_error(@_) };
916 # I think there's a buggette here...
917 # if the first call throws an exception, we don't set it up right.
918 # Not fatal, but we might want to address it.
919 my $handler = $callbacks->{'Handler'};
920 $self->{Methods}->{'fatal_error'} = sub { $handler->fatal_error(@_) };
925 $self->{Methods}->{'fatal_error'} = sub { };
933 if (defined $self->{Methods}->{'end_cdata'}) {
934 $self->{Methods}->{'end_cdata'}->(@_);
939 if (exists $self->{ParseOptions}) {
940 $callbacks = $self->{ParseOptions};
945 if (0) { # dummy to make elsif's below compile
947 elsif (defined $callbacks->{'DocumentHandler'} and $method = $callbacks->{'DocumentHandler'}->can('end_cdata') ) {
948 my $handler = $callbacks->{'DocumentHandler'};
949 $self->{Methods}->{'end_cdata'} = sub { $method->($handler, @_) };
950 return $method->($handler, @_);
952 elsif (defined $callbacks->{'LexicalHandler'} and $method = $callbacks->{'LexicalHandler'}->can('end_cdata') ) {
953 my $handler = $callbacks->{'LexicalHandler'};
954 $self->{Methods}->{'end_cdata'} = sub { $method->($handler, @_) };
955 return $method->($handler, @_);
957 elsif (defined $callbacks->{'Handler'} and $method = $callbacks->{'Handler'}->can('end_cdata') ) {
958 my $handler = $callbacks->{'Handler'};
959 $self->{Methods}->{'end_cdata'} = sub { $method->($handler, @_) };
960 return $method->($handler, @_);
962 elsif (defined $callbacks->{'DocumentHandler'}
963 and $callbacks->{'DocumentHandler'}->can('AUTOLOAD')
964 and $callbacks->{'DocumentHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
967 my $res = eval { $callbacks->{'DocumentHandler'}->end_cdata(@_) };
972 # I think there's a buggette here...
973 # if the first call throws an exception, we don't set it up right.
974 # Not fatal, but we might want to address it.
975 my $handler = $callbacks->{'DocumentHandler'};
976 $self->{Methods}->{'end_cdata'} = sub { $handler->end_cdata(@_) };
980 elsif (defined $callbacks->{'LexicalHandler'}
981 and $callbacks->{'LexicalHandler'}->can('AUTOLOAD')
982 and $callbacks->{'LexicalHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
985 my $res = eval { $callbacks->{'LexicalHandler'}->end_cdata(@_) };
990 # I think there's a buggette here...
991 # if the first call throws an exception, we don't set it up right.
992 # Not fatal, but we might want to address it.
993 my $handler = $callbacks->{'LexicalHandler'};
994 $self->{Methods}->{'end_cdata'} = sub { $handler->end_cdata(@_) };
998 elsif (defined $callbacks->{'Handler'}
999 and $callbacks->{'Handler'}->can('AUTOLOAD')
1000 and $callbacks->{'Handler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
1003 my $res = eval { $callbacks->{'Handler'}->end_cdata(@_) };
1008 # I think there's a buggette here...
1009 # if the first call throws an exception, we don't set it up right.
1010 # Not fatal, but we might want to address it.
1011 my $handler = $callbacks->{'Handler'};
1012 $self->{Methods}->{'end_cdata'} = sub { $handler->end_cdata(@_) };
1017 $self->{Methods}->{'end_cdata'} = sub { };
1025 if (defined $self->{Methods}->{'start_entity'}) {
1026 $self->{Methods}->{'start_entity'}->(@_);
1031 if (exists $self->{ParseOptions}) {
1032 $callbacks = $self->{ParseOptions};
1037 if (0) { # dummy to make elsif's below compile
1039 elsif (defined $callbacks->{'LexicalHandler'} and $method = $callbacks->{'LexicalHandler'}->can('start_entity') ) {
1040 my $handler = $callbacks->{'LexicalHandler'};
1041 $self->{Methods}->{'start_entity'} = sub { $method->($handler, @_) };
1042 return $method->($handler, @_);
1044 elsif (defined $callbacks->{'Handler'} and $method = $callbacks->{'Handler'}->can('start_entity') ) {
1045 my $handler = $callbacks->{'Handler'};
1046 $self->{Methods}->{'start_entity'} = sub { $method->($handler, @_) };
1047 return $method->($handler, @_);
1049 elsif (defined $callbacks->{'LexicalHandler'}
1050 and $callbacks->{'LexicalHandler'}->can('AUTOLOAD')
1051 and $callbacks->{'LexicalHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
1054 my $res = eval { $callbacks->{'LexicalHandler'}->start_entity(@_) };
1059 # I think there's a buggette here...
1060 # if the first call throws an exception, we don't set it up right.
1061 # Not fatal, but we might want to address it.
1062 my $handler = $callbacks->{'LexicalHandler'};
1063 $self->{Methods}->{'start_entity'} = sub { $handler->start_entity(@_) };
1067 elsif (defined $callbacks->{'Handler'}
1068 and $callbacks->{'Handler'}->can('AUTOLOAD')
1069 and $callbacks->{'Handler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
1072 my $res = eval { $callbacks->{'Handler'}->start_entity(@_) };
1077 # I think there's a buggette here...
1078 # if the first call throws an exception, we don't set it up right.
1079 # Not fatal, but we might want to address it.
1080 my $handler = $callbacks->{'Handler'};
1081 $self->{Methods}->{'start_entity'} = sub { $handler->start_entity(@_) };
1086 $self->{Methods}->{'start_entity'} = sub { };
1092 sub start_prefix_mapping {
1094 if (defined $self->{Methods}->{'start_prefix_mapping'}) {
1095 $self->{Methods}->{'start_prefix_mapping'}->(@_);
1100 if (exists $self->{ParseOptions}) {
1101 $callbacks = $self->{ParseOptions};
1106 if (0) { # dummy to make elsif's below compile
1108 elsif (defined $callbacks->{'ContentHandler'} and $method = $callbacks->{'ContentHandler'}->can('start_prefix_mapping') ) {
1109 my $handler = $callbacks->{'ContentHandler'};
1110 $self->{Methods}->{'start_prefix_mapping'} = sub { $method->($handler, @_) };
1111 return $method->($handler, @_);
1113 elsif (defined $callbacks->{'Handler'} and $method = $callbacks->{'Handler'}->can('start_prefix_mapping') ) {
1114 my $handler = $callbacks->{'Handler'};
1115 $self->{Methods}->{'start_prefix_mapping'} = sub { $method->($handler, @_) };
1116 return $method->($handler, @_);
1118 elsif (defined $callbacks->{'ContentHandler'}
1119 and $callbacks->{'ContentHandler'}->can('AUTOLOAD')
1120 and $callbacks->{'ContentHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
1123 my $res = eval { $callbacks->{'ContentHandler'}->start_prefix_mapping(@_) };
1128 # I think there's a buggette here...
1129 # if the first call throws an exception, we don't set it up right.
1130 # Not fatal, but we might want to address it.
1131 my $handler = $callbacks->{'ContentHandler'};
1132 $self->{Methods}->{'start_prefix_mapping'} = sub { $handler->start_prefix_mapping(@_) };
1136 elsif (defined $callbacks->{'Handler'}
1137 and $callbacks->{'Handler'}->can('AUTOLOAD')
1138 and $callbacks->{'Handler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
1141 my $res = eval { $callbacks->{'Handler'}->start_prefix_mapping(@_) };
1146 # I think there's a buggette here...
1147 # if the first call throws an exception, we don't set it up right.
1148 # Not fatal, but we might want to address it.
1149 my $handler = $callbacks->{'Handler'};
1150 $self->{Methods}->{'start_prefix_mapping'} = sub { $handler->start_prefix_mapping(@_) };
1155 $self->{Methods}->{'start_prefix_mapping'} = sub { };
1163 if (defined $self->{Methods}->{'error'}) {
1164 $self->{Methods}->{'error'}->(@_);
1169 if (exists $self->{ParseOptions}) {
1170 $callbacks = $self->{ParseOptions};
1175 if (0) { # dummy to make elsif's below compile
1177 elsif (defined $callbacks->{'ErrorHandler'} and $method = $callbacks->{'ErrorHandler'}->can('error') ) {
1178 my $handler = $callbacks->{'ErrorHandler'};
1179 $self->{Methods}->{'error'} = sub { $method->($handler, @_) };
1180 return $method->($handler, @_);
1182 elsif (defined $callbacks->{'Handler'} and $method = $callbacks->{'Handler'}->can('error') ) {
1183 my $handler = $callbacks->{'Handler'};
1184 $self->{Methods}->{'error'} = sub { $method->($handler, @_) };
1185 return $method->($handler, @_);
1187 elsif (defined $callbacks->{'ErrorHandler'}
1188 and $callbacks->{'ErrorHandler'}->can('AUTOLOAD')
1189 and $callbacks->{'ErrorHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
1192 my $res = eval { $callbacks->{'ErrorHandler'}->error(@_) };
1197 # I think there's a buggette here...
1198 # if the first call throws an exception, we don't set it up right.
1199 # Not fatal, but we might want to address it.
1200 my $handler = $callbacks->{'ErrorHandler'};
1201 $self->{Methods}->{'error'} = sub { $handler->error(@_) };
1205 elsif (defined $callbacks->{'Handler'}
1206 and $callbacks->{'Handler'}->can('AUTOLOAD')
1207 and $callbacks->{'Handler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
1210 my $res = eval { $callbacks->{'Handler'}->error(@_) };
1215 # I think there's a buggette here...
1216 # if the first call throws an exception, we don't set it up right.
1217 # Not fatal, but we might want to address it.
1218 my $handler = $callbacks->{'Handler'};
1219 $self->{Methods}->{'error'} = sub { $handler->error(@_) };
1224 $self->{Methods}->{'error'} = sub { };
1230 sub start_document {
1232 if (defined $self->{Methods}->{'start_document'}) {
1233 $self->{Methods}->{'start_document'}->(@_);
1238 if (exists $self->{ParseOptions}) {
1239 $callbacks = $self->{ParseOptions};
1244 if (0) { # dummy to make elsif's below compile
1246 elsif (defined $callbacks->{'ContentHandler'} and $method = $callbacks->{'ContentHandler'}->can('start_document') ) {
1247 my $handler = $callbacks->{'ContentHandler'};
1248 $self->{Methods}->{'start_document'} = sub { $method->($handler, @_) };
1249 return $method->($handler, @_);
1251 elsif (defined $callbacks->{'DocumentHandler'} and $method = $callbacks->{'DocumentHandler'}->can('start_document') ) {
1252 my $handler = $callbacks->{'DocumentHandler'};
1253 $self->{Methods}->{'start_document'} = sub { $method->($handler, @_) };
1254 return $method->($handler, @_);
1256 elsif (defined $callbacks->{'Handler'} and $method = $callbacks->{'Handler'}->can('start_document') ) {
1257 my $handler = $callbacks->{'Handler'};
1258 $self->{Methods}->{'start_document'} = sub { $method->($handler, @_) };
1259 return $method->($handler, @_);
1261 elsif (defined $callbacks->{'ContentHandler'}
1262 and $callbacks->{'ContentHandler'}->can('AUTOLOAD')
1263 and $callbacks->{'ContentHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
1266 my $res = eval { $callbacks->{'ContentHandler'}->start_document(@_) };
1271 # I think there's a buggette here...
1272 # if the first call throws an exception, we don't set it up right.
1273 # Not fatal, but we might want to address it.
1274 my $handler = $callbacks->{'ContentHandler'};
1275 $self->{Methods}->{'start_document'} = sub { $handler->start_document(@_) };
1279 elsif (defined $callbacks->{'DocumentHandler'}
1280 and $callbacks->{'DocumentHandler'}->can('AUTOLOAD')
1281 and $callbacks->{'DocumentHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
1284 my $res = eval { $callbacks->{'DocumentHandler'}->start_document(@_) };
1289 # I think there's a buggette here...
1290 # if the first call throws an exception, we don't set it up right.
1291 # Not fatal, but we might want to address it.
1292 my $handler = $callbacks->{'DocumentHandler'};
1293 $self->{Methods}->{'start_document'} = sub { $handler->start_document(@_) };
1297 elsif (defined $callbacks->{'Handler'}
1298 and $callbacks->{'Handler'}->can('AUTOLOAD')
1299 and $callbacks->{'Handler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
1302 my $res = eval { $callbacks->{'Handler'}->start_document(@_) };
1307 # I think there's a buggette here...
1308 # if the first call throws an exception, we don't set it up right.
1309 # Not fatal, but we might want to address it.
1310 my $handler = $callbacks->{'Handler'};
1311 $self->{Methods}->{'start_document'} = sub { $handler->start_document(@_) };
1316 $self->{Methods}->{'start_document'} = sub { };
1322 sub ignorable_whitespace {
1324 if (defined $self->{Methods}->{'ignorable_whitespace'}) {
1325 $self->{Methods}->{'ignorable_whitespace'}->(@_);
1330 if (exists $self->{ParseOptions}) {
1331 $callbacks = $self->{ParseOptions};
1336 if (0) { # dummy to make elsif's below compile
1338 elsif (defined $callbacks->{'ContentHandler'} and $method = $callbacks->{'ContentHandler'}->can('ignorable_whitespace') ) {
1339 my $handler = $callbacks->{'ContentHandler'};
1340 $self->{Methods}->{'ignorable_whitespace'} = sub { $method->($handler, @_) };
1341 return $method->($handler, @_);
1343 elsif (defined $callbacks->{'DocumentHandler'} and $method = $callbacks->{'DocumentHandler'}->can('ignorable_whitespace') ) {
1344 my $handler = $callbacks->{'DocumentHandler'};
1345 $self->{Methods}->{'ignorable_whitespace'} = sub { $method->($handler, @_) };
1346 return $method->($handler, @_);
1348 elsif (defined $callbacks->{'Handler'} and $method = $callbacks->{'Handler'}->can('ignorable_whitespace') ) {
1349 my $handler = $callbacks->{'Handler'};
1350 $self->{Methods}->{'ignorable_whitespace'} = sub { $method->($handler, @_) };
1351 return $method->($handler, @_);
1353 elsif (defined $callbacks->{'ContentHandler'}
1354 and $callbacks->{'ContentHandler'}->can('AUTOLOAD')
1355 and $callbacks->{'ContentHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
1358 my $res = eval { $callbacks->{'ContentHandler'}->ignorable_whitespace(@_) };
1363 # I think there's a buggette here...
1364 # if the first call throws an exception, we don't set it up right.
1365 # Not fatal, but we might want to address it.
1366 my $handler = $callbacks->{'ContentHandler'};
1367 $self->{Methods}->{'ignorable_whitespace'} = sub { $handler->ignorable_whitespace(@_) };
1371 elsif (defined $callbacks->{'DocumentHandler'}
1372 and $callbacks->{'DocumentHandler'}->can('AUTOLOAD')
1373 and $callbacks->{'DocumentHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
1376 my $res = eval { $callbacks->{'DocumentHandler'}->ignorable_whitespace(@_) };
1381 # I think there's a buggette here...
1382 # if the first call throws an exception, we don't set it up right.
1383 # Not fatal, but we might want to address it.
1384 my $handler = $callbacks->{'DocumentHandler'};
1385 $self->{Methods}->{'ignorable_whitespace'} = sub { $handler->ignorable_whitespace(@_) };
1389 elsif (defined $callbacks->{'Handler'}
1390 and $callbacks->{'Handler'}->can('AUTOLOAD')
1391 and $callbacks->{'Handler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
1394 my $res = eval { $callbacks->{'Handler'}->ignorable_whitespace(@_) };
1399 # I think there's a buggette here...
1400 # if the first call throws an exception, we don't set it up right.
1401 # Not fatal, but we might want to address it.
1402 my $handler = $callbacks->{'Handler'};
1403 $self->{Methods}->{'ignorable_whitespace'} = sub { $handler->ignorable_whitespace(@_) };
1408 $self->{Methods}->{'ignorable_whitespace'} = sub { };
1416 if (defined $self->{Methods}->{'end_document'}) {
1417 $self->{Methods}->{'end_document'}->(@_);
1422 if (exists $self->{ParseOptions}) {
1423 $callbacks = $self->{ParseOptions};
1428 if (0) { # dummy to make elsif's below compile
1430 elsif (defined $callbacks->{'ContentHandler'} and $method = $callbacks->{'ContentHandler'}->can('end_document') ) {
1431 my $handler = $callbacks->{'ContentHandler'};
1432 $self->{Methods}->{'end_document'} = sub { $method->($handler, @_) };
1433 return $method->($handler, @_);
1435 elsif (defined $callbacks->{'DocumentHandler'} and $method = $callbacks->{'DocumentHandler'}->can('end_document') ) {
1436 my $handler = $callbacks->{'DocumentHandler'};
1437 $self->{Methods}->{'end_document'} = sub { $method->($handler, @_) };
1438 return $method->($handler, @_);
1440 elsif (defined $callbacks->{'Handler'} and $method = $callbacks->{'Handler'}->can('end_document') ) {
1441 my $handler = $callbacks->{'Handler'};
1442 $self->{Methods}->{'end_document'} = sub { $method->($handler, @_) };
1443 return $method->($handler, @_);
1445 elsif (defined $callbacks->{'ContentHandler'}
1446 and $callbacks->{'ContentHandler'}->can('AUTOLOAD')
1447 and $callbacks->{'ContentHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
1450 my $res = eval { $callbacks->{'ContentHandler'}->end_document(@_) };
1455 # I think there's a buggette here...
1456 # if the first call throws an exception, we don't set it up right.
1457 # Not fatal, but we might want to address it.
1458 my $handler = $callbacks->{'ContentHandler'};
1459 $self->{Methods}->{'end_document'} = sub { $handler->end_document(@_) };
1463 elsif (defined $callbacks->{'DocumentHandler'}
1464 and $callbacks->{'DocumentHandler'}->can('AUTOLOAD')
1465 and $callbacks->{'DocumentHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
1468 my $res = eval { $callbacks->{'DocumentHandler'}->end_document(@_) };
1473 # I think there's a buggette here...
1474 # if the first call throws an exception, we don't set it up right.
1475 # Not fatal, but we might want to address it.
1476 my $handler = $callbacks->{'DocumentHandler'};
1477 $self->{Methods}->{'end_document'} = sub { $handler->end_document(@_) };
1481 elsif (defined $callbacks->{'Handler'}
1482 and $callbacks->{'Handler'}->can('AUTOLOAD')
1483 and $callbacks->{'Handler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
1486 my $res = eval { $callbacks->{'Handler'}->end_document(@_) };
1491 # I think there's a buggette here...
1492 # if the first call throws an exception, we don't set it up right.
1493 # Not fatal, but we might want to address it.
1494 my $handler = $callbacks->{'Handler'};
1495 $self->{Methods}->{'end_document'} = sub { $handler->end_document(@_) };
1500 $self->{Methods}->{'end_document'} = sub { };
1508 if (defined $self->{Methods}->{'start_cdata'}) {
1509 $self->{Methods}->{'start_cdata'}->(@_);
1514 if (exists $self->{ParseOptions}) {
1515 $callbacks = $self->{ParseOptions};
1520 if (0) { # dummy to make elsif's below compile
1522 elsif (defined $callbacks->{'DocumentHandler'} and $method = $callbacks->{'DocumentHandler'}->can('start_cdata') ) {
1523 my $handler = $callbacks->{'DocumentHandler'};
1524 $self->{Methods}->{'start_cdata'} = sub { $method->($handler, @_) };
1525 return $method->($handler, @_);
1527 elsif (defined $callbacks->{'LexicalHandler'} and $method = $callbacks->{'LexicalHandler'}->can('start_cdata') ) {
1528 my $handler = $callbacks->{'LexicalHandler'};
1529 $self->{Methods}->{'start_cdata'} = sub { $method->($handler, @_) };
1530 return $method->($handler, @_);
1532 elsif (defined $callbacks->{'Handler'} and $method = $callbacks->{'Handler'}->can('start_cdata') ) {
1533 my $handler = $callbacks->{'Handler'};
1534 $self->{Methods}->{'start_cdata'} = sub { $method->($handler, @_) };
1535 return $method->($handler, @_);
1537 elsif (defined $callbacks->{'DocumentHandler'}
1538 and $callbacks->{'DocumentHandler'}->can('AUTOLOAD')
1539 and $callbacks->{'DocumentHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
1542 my $res = eval { $callbacks->{'DocumentHandler'}->start_cdata(@_) };
1547 # I think there's a buggette here...
1548 # if the first call throws an exception, we don't set it up right.
1549 # Not fatal, but we might want to address it.
1550 my $handler = $callbacks->{'DocumentHandler'};
1551 $self->{Methods}->{'start_cdata'} = sub { $handler->start_cdata(@_) };
1555 elsif (defined $callbacks->{'LexicalHandler'}
1556 and $callbacks->{'LexicalHandler'}->can('AUTOLOAD')
1557 and $callbacks->{'LexicalHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
1560 my $res = eval { $callbacks->{'LexicalHandler'}->start_cdata(@_) };
1565 # I think there's a buggette here...
1566 # if the first call throws an exception, we don't set it up right.
1567 # Not fatal, but we might want to address it.
1568 my $handler = $callbacks->{'LexicalHandler'};
1569 $self->{Methods}->{'start_cdata'} = sub { $handler->start_cdata(@_) };
1573 elsif (defined $callbacks->{'Handler'}
1574 and $callbacks->{'Handler'}->can('AUTOLOAD')
1575 and $callbacks->{'Handler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
1578 my $res = eval { $callbacks->{'Handler'}->start_cdata(@_) };
1583 # I think there's a buggette here...
1584 # if the first call throws an exception, we don't set it up right.
1585 # Not fatal, but we might want to address it.
1586 my $handler = $callbacks->{'Handler'};
1587 $self->{Methods}->{'start_cdata'} = sub { $handler->start_cdata(@_) };
1592 $self->{Methods}->{'start_cdata'} = sub { };
1598 sub set_document_locator {
1600 if (defined $self->{Methods}->{'set_document_locator'}) {
1601 $self->{Methods}->{'set_document_locator'}->(@_);
1606 if (exists $self->{ParseOptions}) {
1607 $callbacks = $self->{ParseOptions};
1612 if (0) { # dummy to make elsif's below compile
1614 elsif (defined $callbacks->{'ContentHandler'} and $method = $callbacks->{'ContentHandler'}->can('set_document_locator') ) {
1615 my $handler = $callbacks->{'ContentHandler'};
1616 $self->{Methods}->{'set_document_locator'} = sub { $method->($handler, @_) };
1617 return $method->($handler, @_);
1619 elsif (defined $callbacks->{'DocumentHandler'} and $method = $callbacks->{'DocumentHandler'}->can('set_document_locator') ) {
1620 my $handler = $callbacks->{'DocumentHandler'};
1621 $self->{Methods}->{'set_document_locator'} = sub { $method->($handler, @_) };
1622 return $method->($handler, @_);
1624 elsif (defined $callbacks->{'Handler'} and $method = $callbacks->{'Handler'}->can('set_document_locator') ) {
1625 my $handler = $callbacks->{'Handler'};
1626 $self->{Methods}->{'set_document_locator'} = sub { $method->($handler, @_) };
1627 return $method->($handler, @_);
1629 elsif (defined $callbacks->{'ContentHandler'}
1630 and $callbacks->{'ContentHandler'}->can('AUTOLOAD')
1631 and $callbacks->{'ContentHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
1634 my $res = eval { $callbacks->{'ContentHandler'}->set_document_locator(@_) };
1639 # I think there's a buggette here...
1640 # if the first call throws an exception, we don't set it up right.
1641 # Not fatal, but we might want to address it.
1642 my $handler = $callbacks->{'ContentHandler'};
1643 $self->{Methods}->{'set_document_locator'} = sub { $handler->set_document_locator(@_) };
1647 elsif (defined $callbacks->{'DocumentHandler'}
1648 and $callbacks->{'DocumentHandler'}->can('AUTOLOAD')
1649 and $callbacks->{'DocumentHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
1652 my $res = eval { $callbacks->{'DocumentHandler'}->set_document_locator(@_) };
1657 # I think there's a buggette here...
1658 # if the first call throws an exception, we don't set it up right.
1659 # Not fatal, but we might want to address it.
1660 my $handler = $callbacks->{'DocumentHandler'};
1661 $self->{Methods}->{'set_document_locator'} = sub { $handler->set_document_locator(@_) };
1665 elsif (defined $callbacks->{'Handler'}
1666 and $callbacks->{'Handler'}->can('AUTOLOAD')
1667 and $callbacks->{'Handler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
1670 my $res = eval { $callbacks->{'Handler'}->set_document_locator(@_) };
1675 # I think there's a buggette here...
1676 # if the first call throws an exception, we don't set it up right.
1677 # Not fatal, but we might want to address it.
1678 my $handler = $callbacks->{'Handler'};
1679 $self->{Methods}->{'set_document_locator'} = sub { $handler->set_document_locator(@_) };
1684 $self->{Methods}->{'set_document_locator'} = sub { };
1692 if (defined $self->{Methods}->{'attlist_decl'}) {
1693 $self->{Methods}->{'attlist_decl'}->(@_);
1698 if (exists $self->{ParseOptions}) {
1699 $callbacks = $self->{ParseOptions};
1704 if (0) { # dummy to make elsif's below compile
1706 elsif (defined $callbacks->{'DTDHandler'} and $method = $callbacks->{'DTDHandler'}->can('attlist_decl') ) {
1707 my $handler = $callbacks->{'DTDHandler'};
1708 $self->{Methods}->{'attlist_decl'} = sub { $method->($handler, @_) };
1709 return $method->($handler, @_);
1711 elsif (defined $callbacks->{'Handler'} and $method = $callbacks->{'Handler'}->can('attlist_decl') ) {
1712 my $handler = $callbacks->{'Handler'};
1713 $self->{Methods}->{'attlist_decl'} = sub { $method->($handler, @_) };
1714 return $method->($handler, @_);
1716 elsif (defined $callbacks->{'DTDHandler'}
1717 and $callbacks->{'DTDHandler'}->can('AUTOLOAD')
1718 and $callbacks->{'DTDHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
1721 my $res = eval { $callbacks->{'DTDHandler'}->attlist_decl(@_) };
1726 # I think there's a buggette here...
1727 # if the first call throws an exception, we don't set it up right.
1728 # Not fatal, but we might want to address it.
1729 my $handler = $callbacks->{'DTDHandler'};
1730 $self->{Methods}->{'attlist_decl'} = sub { $handler->attlist_decl(@_) };
1734 elsif (defined $callbacks->{'Handler'}
1735 and $callbacks->{'Handler'}->can('AUTOLOAD')
1736 and $callbacks->{'Handler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
1739 my $res = eval { $callbacks->{'Handler'}->attlist_decl(@_) };
1744 # I think there's a buggette here...
1745 # if the first call throws an exception, we don't set it up right.
1746 # Not fatal, but we might want to address it.
1747 my $handler = $callbacks->{'Handler'};
1748 $self->{Methods}->{'attlist_decl'} = sub { $handler->attlist_decl(@_) };
1753 $self->{Methods}->{'attlist_decl'} = sub { };
1761 if (defined $self->{Methods}->{'start_dtd'}) {
1762 $self->{Methods}->{'start_dtd'}->(@_);
1767 if (exists $self->{ParseOptions}) {
1768 $callbacks = $self->{ParseOptions};
1773 if (0) { # dummy to make elsif's below compile
1775 elsif (defined $callbacks->{'LexicalHandler'} and $method = $callbacks->{'LexicalHandler'}->can('start_dtd') ) {
1776 my $handler = $callbacks->{'LexicalHandler'};
1777 $self->{Methods}->{'start_dtd'} = sub { $method->($handler, @_) };
1778 return $method->($handler, @_);
1780 elsif (defined $callbacks->{'Handler'} and $method = $callbacks->{'Handler'}->can('start_dtd') ) {
1781 my $handler = $callbacks->{'Handler'};
1782 $self->{Methods}->{'start_dtd'} = sub { $method->($handler, @_) };
1783 return $method->($handler, @_);
1785 elsif (defined $callbacks->{'LexicalHandler'}
1786 and $callbacks->{'LexicalHandler'}->can('AUTOLOAD')
1787 and $callbacks->{'LexicalHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
1790 my $res = eval { $callbacks->{'LexicalHandler'}->start_dtd(@_) };
1795 # I think there's a buggette here...
1796 # if the first call throws an exception, we don't set it up right.
1797 # Not fatal, but we might want to address it.
1798 my $handler = $callbacks->{'LexicalHandler'};
1799 $self->{Methods}->{'start_dtd'} = sub { $handler->start_dtd(@_) };
1803 elsif (defined $callbacks->{'Handler'}
1804 and $callbacks->{'Handler'}->can('AUTOLOAD')
1805 and $callbacks->{'Handler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
1808 my $res = eval { $callbacks->{'Handler'}->start_dtd(@_) };
1813 # I think there's a buggette here...
1814 # if the first call throws an exception, we don't set it up right.
1815 # Not fatal, but we might want to address it.
1816 my $handler = $callbacks->{'Handler'};
1817 $self->{Methods}->{'start_dtd'} = sub { $handler->start_dtd(@_) };
1822 $self->{Methods}->{'start_dtd'} = sub { };
1828 sub resolve_entity {
1830 if (defined $self->{Methods}->{'resolve_entity'}) {
1831 $self->{Methods}->{'resolve_entity'}->(@_);
1836 if (exists $self->{ParseOptions}) {
1837 $callbacks = $self->{ParseOptions};
1842 if (0) { # dummy to make elsif's below compile
1844 elsif (defined $callbacks->{'EntityResolver'} and $method = $callbacks->{'EntityResolver'}->can('resolve_entity') ) {
1845 my $handler = $callbacks->{'EntityResolver'};
1846 $self->{Methods}->{'resolve_entity'} = sub { $method->($handler, @_) };
1847 return $method->($handler, @_);
1849 elsif (defined $callbacks->{'Handler'} and $method = $callbacks->{'Handler'}->can('resolve_entity') ) {
1850 my $handler = $callbacks->{'Handler'};
1851 $self->{Methods}->{'resolve_entity'} = sub { $method->($handler, @_) };
1852 return $method->($handler, @_);
1854 elsif (defined $callbacks->{'EntityResolver'}
1855 and $callbacks->{'EntityResolver'}->can('AUTOLOAD')
1856 and $callbacks->{'EntityResolver'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
1859 my $res = eval { $callbacks->{'EntityResolver'}->resolve_entity(@_) };
1864 # I think there's a buggette here...
1865 # if the first call throws an exception, we don't set it up right.
1866 # Not fatal, but we might want to address it.
1867 my $handler = $callbacks->{'EntityResolver'};
1868 $self->{Methods}->{'resolve_entity'} = sub { $handler->resolve_entity(@_) };
1872 elsif (defined $callbacks->{'Handler'}
1873 and $callbacks->{'Handler'}->can('AUTOLOAD')
1874 and $callbacks->{'Handler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
1877 my $res = eval { $callbacks->{'Handler'}->resolve_entity(@_) };
1882 # I think there's a buggette here...
1883 # if the first call throws an exception, we don't set it up right.
1884 # Not fatal, but we might want to address it.
1885 my $handler = $callbacks->{'Handler'};
1886 $self->{Methods}->{'resolve_entity'} = sub { $handler->resolve_entity(@_) };
1891 $self->{Methods}->{'resolve_entity'} = sub { };
1897 sub entity_reference {
1899 if (defined $self->{Methods}->{'entity_reference'}) {
1900 $self->{Methods}->{'entity_reference'}->(@_);
1905 if (exists $self->{ParseOptions}) {
1906 $callbacks = $self->{ParseOptions};
1911 if (0) { # dummy to make elsif's below compile
1913 elsif (defined $callbacks->{'DocumentHandler'} and $method = $callbacks->{'DocumentHandler'}->can('entity_reference') ) {
1914 my $handler = $callbacks->{'DocumentHandler'};
1915 $self->{Methods}->{'entity_reference'} = sub { $method->($handler, @_) };
1916 return $method->($handler, @_);
1918 elsif (defined $callbacks->{'Handler'} and $method = $callbacks->{'Handler'}->can('entity_reference') ) {
1919 my $handler = $callbacks->{'Handler'};
1920 $self->{Methods}->{'entity_reference'} = sub { $method->($handler, @_) };
1921 return $method->($handler, @_);
1923 elsif (defined $callbacks->{'DocumentHandler'}
1924 and $callbacks->{'DocumentHandler'}->can('AUTOLOAD')
1925 and $callbacks->{'DocumentHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
1928 my $res = eval { $callbacks->{'DocumentHandler'}->entity_reference(@_) };
1933 # I think there's a buggette here...
1934 # if the first call throws an exception, we don't set it up right.
1935 # Not fatal, but we might want to address it.
1936 my $handler = $callbacks->{'DocumentHandler'};
1937 $self->{Methods}->{'entity_reference'} = sub { $handler->entity_reference(@_) };
1941 elsif (defined $callbacks->{'Handler'}
1942 and $callbacks->{'Handler'}->can('AUTOLOAD')
1943 and $callbacks->{'Handler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
1946 my $res = eval { $callbacks->{'Handler'}->entity_reference(@_) };
1951 # I think there's a buggette here...
1952 # if the first call throws an exception, we don't set it up right.
1953 # Not fatal, but we might want to address it.
1954 my $handler = $callbacks->{'Handler'};
1955 $self->{Methods}->{'entity_reference'} = sub { $handler->entity_reference(@_) };
1960 $self->{Methods}->{'entity_reference'} = sub { };
1968 if (defined $self->{Methods}->{'element_decl'}) {
1969 $self->{Methods}->{'element_decl'}->(@_);
1974 if (exists $self->{ParseOptions}) {
1975 $callbacks = $self->{ParseOptions};
1980 if (0) { # dummy to make elsif's below compile
1982 elsif (defined $callbacks->{'DeclHandler'} and $method = $callbacks->{'DeclHandler'}->can('element_decl') ) {
1983 my $handler = $callbacks->{'DeclHandler'};
1984 $self->{Methods}->{'element_decl'} = sub { $method->($handler, @_) };
1985 return $method->($handler, @_);
1987 elsif (defined $callbacks->{'Handler'} and $method = $callbacks->{'Handler'}->can('element_decl') ) {
1988 my $handler = $callbacks->{'Handler'};
1989 $self->{Methods}->{'element_decl'} = sub { $method->($handler, @_) };
1990 return $method->($handler, @_);
1992 elsif (defined $callbacks->{'DeclHandler'}
1993 and $callbacks->{'DeclHandler'}->can('AUTOLOAD')
1994 and $callbacks->{'DeclHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
1997 my $res = eval { $callbacks->{'DeclHandler'}->element_decl(@_) };
2002 # I think there's a buggette here...
2003 # if the first call throws an exception, we don't set it up right.
2004 # Not fatal, but we might want to address it.
2005 my $handler = $callbacks->{'DeclHandler'};
2006 $self->{Methods}->{'element_decl'} = sub { $handler->element_decl(@_) };
2010 elsif (defined $callbacks->{'Handler'}
2011 and $callbacks->{'Handler'}->can('AUTOLOAD')
2012 and $callbacks->{'Handler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
2015 my $res = eval { $callbacks->{'Handler'}->element_decl(@_) };
2020 # I think there's a buggette here...
2021 # if the first call throws an exception, we don't set it up right.
2022 # Not fatal, but we might want to address it.
2023 my $handler = $callbacks->{'Handler'};
2024 $self->{Methods}->{'element_decl'} = sub { $handler->element_decl(@_) };
2029 $self->{Methods}->{'element_decl'} = sub { };
2037 if (defined $self->{Methods}->{'notation_decl'}) {
2038 $self->{Methods}->{'notation_decl'}->(@_);
2043 if (exists $self->{ParseOptions}) {
2044 $callbacks = $self->{ParseOptions};
2049 if (0) { # dummy to make elsif's below compile
2051 elsif (defined $callbacks->{'DTDHandler'} and $method = $callbacks->{'DTDHandler'}->can('notation_decl') ) {
2052 my $handler = $callbacks->{'DTDHandler'};
2053 $self->{Methods}->{'notation_decl'} = sub { $method->($handler, @_) };
2054 return $method->($handler, @_);
2056 elsif (defined $callbacks->{'Handler'} and $method = $callbacks->{'Handler'}->can('notation_decl') ) {
2057 my $handler = $callbacks->{'Handler'};
2058 $self->{Methods}->{'notation_decl'} = sub { $method->($handler, @_) };
2059 return $method->($handler, @_);
2061 elsif (defined $callbacks->{'DTDHandler'}
2062 and $callbacks->{'DTDHandler'}->can('AUTOLOAD')
2063 and $callbacks->{'DTDHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
2066 my $res = eval { $callbacks->{'DTDHandler'}->notation_decl(@_) };
2071 # I think there's a buggette here...
2072 # if the first call throws an exception, we don't set it up right.
2073 # Not fatal, but we might want to address it.
2074 my $handler = $callbacks->{'DTDHandler'};
2075 $self->{Methods}->{'notation_decl'} = sub { $handler->notation_decl(@_) };
2079 elsif (defined $callbacks->{'Handler'}
2080 and $callbacks->{'Handler'}->can('AUTOLOAD')
2081 and $callbacks->{'Handler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
2084 my $res = eval { $callbacks->{'Handler'}->notation_decl(@_) };
2089 # I think there's a buggette here...
2090 # if the first call throws an exception, we don't set it up right.
2091 # Not fatal, but we might want to address it.
2092 my $handler = $callbacks->{'Handler'};
2093 $self->{Methods}->{'notation_decl'} = sub { $handler->notation_decl(@_) };
2098 $self->{Methods}->{'notation_decl'} = sub { };
2104 sub skipped_entity {
2106 if (defined $self->{Methods}->{'skipped_entity'}) {
2107 $self->{Methods}->{'skipped_entity'}->(@_);
2112 if (exists $self->{ParseOptions}) {
2113 $callbacks = $self->{ParseOptions};
2118 if (0) { # dummy to make elsif's below compile
2120 elsif (defined $callbacks->{'ContentHandler'} and $method = $callbacks->{'ContentHandler'}->can('skipped_entity') ) {
2121 my $handler = $callbacks->{'ContentHandler'};
2122 $self->{Methods}->{'skipped_entity'} = sub { $method->($handler, @_) };
2123 return $method->($handler, @_);
2125 elsif (defined $callbacks->{'Handler'} and $method = $callbacks->{'Handler'}->can('skipped_entity') ) {
2126 my $handler = $callbacks->{'Handler'};
2127 $self->{Methods}->{'skipped_entity'} = sub { $method->($handler, @_) };
2128 return $method->($handler, @_);
2130 elsif (defined $callbacks->{'ContentHandler'}
2131 and $callbacks->{'ContentHandler'}->can('AUTOLOAD')
2132 and $callbacks->{'ContentHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
2135 my $res = eval { $callbacks->{'ContentHandler'}->skipped_entity(@_) };
2140 # I think there's a buggette here...
2141 # if the first call throws an exception, we don't set it up right.
2142 # Not fatal, but we might want to address it.
2143 my $handler = $callbacks->{'ContentHandler'};
2144 $self->{Methods}->{'skipped_entity'} = sub { $handler->skipped_entity(@_) };
2148 elsif (defined $callbacks->{'Handler'}
2149 and $callbacks->{'Handler'}->can('AUTOLOAD')
2150 and $callbacks->{'Handler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
2153 my $res = eval { $callbacks->{'Handler'}->skipped_entity(@_) };
2158 # I think there's a buggette here...
2159 # if the first call throws an exception, we don't set it up right.
2160 # Not fatal, but we might want to address it.
2161 my $handler = $callbacks->{'Handler'};
2162 $self->{Methods}->{'skipped_entity'} = sub { $handler->skipped_entity(@_) };
2167 $self->{Methods}->{'skipped_entity'} = sub { };
2175 if (defined $self->{Methods}->{'end_element'}) {
2176 $self->{Methods}->{'end_element'}->(@_);
2181 if (exists $self->{ParseOptions}) {
2182 $callbacks = $self->{ParseOptions};
2187 if (0) { # dummy to make elsif's below compile
2189 elsif (defined $callbacks->{'ContentHandler'} and $method = $callbacks->{'ContentHandler'}->can('end_element') ) {
2190 my $handler = $callbacks->{'ContentHandler'};
2191 $self->{Methods}->{'end_element'} = sub { $method->($handler, @_) };
2192 return $method->($handler, @_);
2194 elsif (defined $callbacks->{'DocumentHandler'} and $method = $callbacks->{'DocumentHandler'}->can('end_element') ) {
2195 my $handler = $callbacks->{'DocumentHandler'};
2196 $self->{Methods}->{'end_element'} = sub { $method->($handler, @_) };
2197 return $method->($handler, @_);
2199 elsif (defined $callbacks->{'Handler'} and $method = $callbacks->{'Handler'}->can('end_element') ) {
2200 my $handler = $callbacks->{'Handler'};
2201 $self->{Methods}->{'end_element'} = sub { $method->($handler, @_) };
2202 return $method->($handler, @_);
2204 elsif (defined $callbacks->{'ContentHandler'}
2205 and $callbacks->{'ContentHandler'}->can('AUTOLOAD')
2206 and $callbacks->{'ContentHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
2209 my $res = eval { $callbacks->{'ContentHandler'}->end_element(@_) };
2214 # I think there's a buggette here...
2215 # if the first call throws an exception, we don't set it up right.
2216 # Not fatal, but we might want to address it.
2217 my $handler = $callbacks->{'ContentHandler'};
2218 $self->{Methods}->{'end_element'} = sub { $handler->end_element(@_) };
2222 elsif (defined $callbacks->{'DocumentHandler'}
2223 and $callbacks->{'DocumentHandler'}->can('AUTOLOAD')
2224 and $callbacks->{'DocumentHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
2227 my $res = eval { $callbacks->{'DocumentHandler'}->end_element(@_) };
2232 # I think there's a buggette here...
2233 # if the first call throws an exception, we don't set it up right.
2234 # Not fatal, but we might want to address it.
2235 my $handler = $callbacks->{'DocumentHandler'};
2236 $self->{Methods}->{'end_element'} = sub { $handler->end_element(@_) };
2240 elsif (defined $callbacks->{'Handler'}
2241 and $callbacks->{'Handler'}->can('AUTOLOAD')
2242 and $callbacks->{'Handler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
2245 my $res = eval { $callbacks->{'Handler'}->end_element(@_) };
2250 # I think there's a buggette here...
2251 # if the first call throws an exception, we don't set it up right.
2252 # Not fatal, but we might want to address it.
2253 my $handler = $callbacks->{'Handler'};
2254 $self->{Methods}->{'end_element'} = sub { $handler->end_element(@_) };
2259 $self->{Methods}->{'end_element'} = sub { };
2267 if (defined $self->{Methods}->{'doctype_decl'}) {
2268 $self->{Methods}->{'doctype_decl'}->(@_);
2273 if (exists $self->{ParseOptions}) {
2274 $callbacks = $self->{ParseOptions};
2279 if (0) { # dummy to make elsif's below compile
2281 elsif (defined $callbacks->{'DTDHandler'} and $method = $callbacks->{'DTDHandler'}->can('doctype_decl') ) {
2282 my $handler = $callbacks->{'DTDHandler'};
2283 $self->{Methods}->{'doctype_decl'} = sub { $method->($handler, @_) };
2284 return $method->($handler, @_);
2286 elsif (defined $callbacks->{'Handler'} and $method = $callbacks->{'Handler'}->can('doctype_decl') ) {
2287 my $handler = $callbacks->{'Handler'};
2288 $self->{Methods}->{'doctype_decl'} = sub { $method->($handler, @_) };
2289 return $method->($handler, @_);
2291 elsif (defined $callbacks->{'DTDHandler'}
2292 and $callbacks->{'DTDHandler'}->can('AUTOLOAD')
2293 and $callbacks->{'DTDHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
2296 my $res = eval { $callbacks->{'DTDHandler'}->doctype_decl(@_) };
2301 # I think there's a buggette here...
2302 # if the first call throws an exception, we don't set it up right.
2303 # Not fatal, but we might want to address it.
2304 my $handler = $callbacks->{'DTDHandler'};
2305 $self->{Methods}->{'doctype_decl'} = sub { $handler->doctype_decl(@_) };
2309 elsif (defined $callbacks->{'Handler'}
2310 and $callbacks->{'Handler'}->can('AUTOLOAD')
2311 and $callbacks->{'Handler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
2314 my $res = eval { $callbacks->{'Handler'}->doctype_decl(@_) };
2319 # I think there's a buggette here...
2320 # if the first call throws an exception, we don't set it up right.
2321 # Not fatal, but we might want to address it.
2322 my $handler = $callbacks->{'Handler'};
2323 $self->{Methods}->{'doctype_decl'} = sub { $handler->doctype_decl(@_) };
2328 $self->{Methods}->{'doctype_decl'} = sub { };
2336 if (defined $self->{Methods}->{'comment'}) {
2337 $self->{Methods}->{'comment'}->(@_);
2342 if (exists $self->{ParseOptions}) {
2343 $callbacks = $self->{ParseOptions};
2348 if (0) { # dummy to make elsif's below compile
2350 elsif (defined $callbacks->{'DocumentHandler'} and $method = $callbacks->{'DocumentHandler'}->can('comment') ) {
2351 my $handler = $callbacks->{'DocumentHandler'};
2352 $self->{Methods}->{'comment'} = sub { $method->($handler, @_) };
2353 return $method->($handler, @_);
2355 elsif (defined $callbacks->{'LexicalHandler'} and $method = $callbacks->{'LexicalHandler'}->can('comment') ) {
2356 my $handler = $callbacks->{'LexicalHandler'};
2357 $self->{Methods}->{'comment'} = sub { $method->($handler, @_) };
2358 return $method->($handler, @_);
2360 elsif (defined $callbacks->{'Handler'} and $method = $callbacks->{'Handler'}->can('comment') ) {
2361 my $handler = $callbacks->{'Handler'};
2362 $self->{Methods}->{'comment'} = sub { $method->($handler, @_) };
2363 return $method->($handler, @_);
2365 elsif (defined $callbacks->{'DocumentHandler'}
2366 and $callbacks->{'DocumentHandler'}->can('AUTOLOAD')
2367 and $callbacks->{'DocumentHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
2370 my $res = eval { $callbacks->{'DocumentHandler'}->comment(@_) };
2375 # I think there's a buggette here...
2376 # if the first call throws an exception, we don't set it up right.
2377 # Not fatal, but we might want to address it.
2378 my $handler = $callbacks->{'DocumentHandler'};
2379 $self->{Methods}->{'comment'} = sub { $handler->comment(@_) };
2383 elsif (defined $callbacks->{'LexicalHandler'}
2384 and $callbacks->{'LexicalHandler'}->can('AUTOLOAD')
2385 and $callbacks->{'LexicalHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
2388 my $res = eval { $callbacks->{'LexicalHandler'}->comment(@_) };
2393 # I think there's a buggette here...
2394 # if the first call throws an exception, we don't set it up right.
2395 # Not fatal, but we might want to address it.
2396 my $handler = $callbacks->{'LexicalHandler'};
2397 $self->{Methods}->{'comment'} = sub { $handler->comment(@_) };
2401 elsif (defined $callbacks->{'Handler'}
2402 and $callbacks->{'Handler'}->can('AUTOLOAD')
2403 and $callbacks->{'Handler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
2406 my $res = eval { $callbacks->{'Handler'}->comment(@_) };
2411 # I think there's a buggette here...
2412 # if the first call throws an exception, we don't set it up right.
2413 # Not fatal, but we might want to address it.
2414 my $handler = $callbacks->{'Handler'};
2415 $self->{Methods}->{'comment'} = sub { $handler->comment(@_) };
2420 $self->{Methods}->{'comment'} = sub { };
2428 if (defined $self->{Methods}->{'end_entity'}) {
2429 $self->{Methods}->{'end_entity'}->(@_);
2434 if (exists $self->{ParseOptions}) {
2435 $callbacks = $self->{ParseOptions};
2440 if (0) { # dummy to make elsif's below compile
2442 elsif (defined $callbacks->{'LexicalHandler'} and $method = $callbacks->{'LexicalHandler'}->can('end_entity') ) {
2443 my $handler = $callbacks->{'LexicalHandler'};
2444 $self->{Methods}->{'end_entity'} = sub { $method->($handler, @_) };
2445 return $method->($handler, @_);
2447 elsif (defined $callbacks->{'Handler'} and $method = $callbacks->{'Handler'}->can('end_entity') ) {
2448 my $handler = $callbacks->{'Handler'};
2449 $self->{Methods}->{'end_entity'} = sub { $method->($handler, @_) };
2450 return $method->($handler, @_);
2452 elsif (defined $callbacks->{'LexicalHandler'}
2453 and $callbacks->{'LexicalHandler'}->can('AUTOLOAD')
2454 and $callbacks->{'LexicalHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
2457 my $res = eval { $callbacks->{'LexicalHandler'}->end_entity(@_) };
2462 # I think there's a buggette here...
2463 # if the first call throws an exception, we don't set it up right.
2464 # Not fatal, but we might want to address it.
2465 my $handler = $callbacks->{'LexicalHandler'};
2466 $self->{Methods}->{'end_entity'} = sub { $handler->end_entity(@_) };
2470 elsif (defined $callbacks->{'Handler'}
2471 and $callbacks->{'Handler'}->can('AUTOLOAD')
2472 and $callbacks->{'Handler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
2475 my $res = eval { $callbacks->{'Handler'}->end_entity(@_) };
2480 # I think there's a buggette here...
2481 # if the first call throws an exception, we don't set it up right.
2482 # Not fatal, but we might want to address it.
2483 my $handler = $callbacks->{'Handler'};
2484 $self->{Methods}->{'end_entity'} = sub { $handler->end_entity(@_) };
2489 $self->{Methods}->{'end_entity'} = sub { };
2497 if (defined $self->{Methods}->{'warning'}) {
2498 $self->{Methods}->{'warning'}->(@_);
2503 if (exists $self->{ParseOptions}) {
2504 $callbacks = $self->{ParseOptions};
2509 if (0) { # dummy to make elsif's below compile
2511 elsif (defined $callbacks->{'ErrorHandler'} and $method = $callbacks->{'ErrorHandler'}->can('warning') ) {
2512 my $handler = $callbacks->{'ErrorHandler'};
2513 $self->{Methods}->{'warning'} = sub { $method->($handler, @_) };
2514 return $method->($handler, @_);
2516 elsif (defined $callbacks->{'Handler'} and $method = $callbacks->{'Handler'}->can('warning') ) {
2517 my $handler = $callbacks->{'Handler'};
2518 $self->{Methods}->{'warning'} = sub { $method->($handler, @_) };
2519 return $method->($handler, @_);
2521 elsif (defined $callbacks->{'ErrorHandler'}
2522 and $callbacks->{'ErrorHandler'}->can('AUTOLOAD')
2523 and $callbacks->{'ErrorHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
2526 my $res = eval { $callbacks->{'ErrorHandler'}->warning(@_) };
2531 # I think there's a buggette here...
2532 # if the first call throws an exception, we don't set it up right.
2533 # Not fatal, but we might want to address it.
2534 my $handler = $callbacks->{'ErrorHandler'};
2535 $self->{Methods}->{'warning'} = sub { $handler->warning(@_) };
2539 elsif (defined $callbacks->{'Handler'}
2540 and $callbacks->{'Handler'}->can('AUTOLOAD')
2541 and $callbacks->{'Handler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
2544 my $res = eval { $callbacks->{'Handler'}->warning(@_) };
2549 # I think there's a buggette here...
2550 # if the first call throws an exception, we don't set it up right.
2551 # Not fatal, but we might want to address it.
2552 my $handler = $callbacks->{'Handler'};
2553 $self->{Methods}->{'warning'} = sub { $handler->warning(@_) };
2558 $self->{Methods}->{'warning'} = sub { };
2564 #-------------------------------------------------------------------#
2565 # Class->new(%options)
2566 #-------------------------------------------------------------------#
2569 my $class = ref($proto) || $proto;
2570 my $options = ($#_ == 0) ? shift : { @_ };
2572 unless ( defined( $options->{Handler} ) or
2573 defined( $options->{ContentHandler} ) or
2574 defined( $options->{DTDHandler} ) or
2575 defined( $options->{DocumentHandler} ) or
2576 defined( $options->{LexicalHandler} ) or
2577 defined( $options->{ErrorHandler} ) or
2578 defined( $options->{DeclHandler} ) ) {
2580 $options->{Handler} = XML::SAX::Base::NoHandler->new;
2583 my $self = bless $options, $class;
2584 # turn NS processing on by default
2585 $self->set_feature('http://xml.org/sax/features/namespaces', 1);
2588 #-------------------------------------------------------------------#
2590 #-------------------------------------------------------------------#
2591 # $p->parse(%options)
2592 #-------------------------------------------------------------------#
2595 my $parse_options = $self->get_options(@_);
2596 local $self->{ParseOptions} = $parse_options;
2597 if ($self->{Parent}) { # calling parse on a filter for some reason
2598 return $self->{Parent}->parse($parse_options);
2602 if (defined $parse_options->{Source}{CharacterStream} and $method = $self->can('_parse_characterstream')) {
2603 warn("parse charstream???\n");
2604 return $method->($self, $parse_options->{Source}{CharacterStream});
2606 elsif (defined $parse_options->{Source}{ByteStream} and $method = $self->can('_parse_bytestream')) {
2607 return $method->($self, $parse_options->{Source}{ByteStream});
2609 elsif (defined $parse_options->{Source}{String} and $method = $self->can('_parse_string')) {
2610 return $method->($self, $parse_options->{Source}{String});
2612 elsif (defined $parse_options->{Source}{SystemId} and $method = $self->can('_parse_systemid')) {
2613 return $method->($self, $parse_options->{Source}{SystemId});
2616 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]";
2620 #-------------------------------------------------------------------#
2622 #-------------------------------------------------------------------#
2623 # $p->parse_file(%options)
2624 #-------------------------------------------------------------------#
2628 return $self->parse_uri($file, @_) if ref(\$file) eq 'SCALAR';
2629 my $parse_options = $self->get_options(@_);
2630 $parse_options->{Source}{ByteStream} = $file;
2631 return $self->parse($parse_options);
2633 #-------------------------------------------------------------------#
2635 #-------------------------------------------------------------------#
2636 # $p->parse_uri(%options)
2637 #-------------------------------------------------------------------#
2641 my $parse_options = $self->get_options(@_);
2642 $parse_options->{Source}{SystemId} = $file;
2643 return $self->parse($parse_options);
2645 #-------------------------------------------------------------------#
2647 #-------------------------------------------------------------------#
2648 # $p->parse_string(%options)
2649 #-------------------------------------------------------------------#
2653 my $parse_options = $self->get_options(@_);
2654 $parse_options->{Source}{String} = $string;
2655 return $self->parse($parse_options);
2657 #-------------------------------------------------------------------#
2659 #-------------------------------------------------------------------#
2661 #-------------------------------------------------------------------#
2666 return { %$self, %{$_[0]} };
2668 return { %$self, @_ };
2671 #-------------------------------------------------------------------#
2673 #-------------------------------------------------------------------#
2675 #-------------------------------------------------------------------#
2678 'http://xml.org/sax/features/external-general-entities' => undef,
2679 'http://xml.org/sax/features/external-parameter-entities' => undef,
2680 'http://xml.org/sax/features/is-standalone' => undef,
2681 'http://xml.org/sax/features/lexical-handler' => undef,
2682 'http://xml.org/sax/features/parameter-entities' => undef,
2683 'http://xml.org/sax/features/namespaces' => 1,
2684 'http://xml.org/sax/features/namespace-prefixes' => 0,
2685 'http://xml.org/sax/features/string-interning' => undef,
2686 'http://xml.org/sax/features/use-attributes2' => undef,
2687 'http://xml.org/sax/features/use-locator2' => undef,
2688 'http://xml.org/sax/features/validation' => undef,
2690 'http://xml.org/sax/properties/dom-node' => undef,
2691 'http://xml.org/sax/properties/xml-string' => undef,
2694 #-------------------------------------------------------------------#
2696 #-------------------------------------------------------------------#
2698 #-------------------------------------------------------------------#
2703 # check %FEATURES to see if it's there, and return it if so
2704 # throw XML::SAX::Exception::NotRecognized if it's not there
2705 # throw XML::SAX::Exception::NotSupported if it's there but we
2708 my %features = $self->get_features();
2709 if (exists $features{$feat}) {
2710 my %supported = map { $_ => 1 } $self->supported_features();
2711 if ($supported{$feat}) {
2712 return $self->{__PACKAGE__ . "::Features"}{$feat};
2714 throw XML::SAX::Exception::NotSupported(
2715 Message => "The feature '$feat' is not supported by " . ref($self),
2719 throw XML::SAX::Exception::NotRecognized(
2720 Message => "The feature '$feat' is not recognized by " . ref($self),
2724 #-------------------------------------------------------------------#
2726 #-------------------------------------------------------------------#
2728 #-------------------------------------------------------------------#
2733 # check %FEATURES to see if it's there, and set it if so
2734 # throw XML::SAX::Exception::NotRecognized if it's not there
2735 # throw XML::SAX::Exception::NotSupported if it's there but we
2738 my %features = $self->get_features();
2739 if (exists $features{$feat}) {
2740 my %supported = map { $_ => 1 } $self->supported_features();
2741 if ($supported{$feat}) {
2742 return $self->{__PACKAGE__ . "::Features"}{$feat} = $value;
2744 throw XML::SAX::Exception::NotSupported(
2745 Message => "The feature '$feat' is not supported by " . ref($self),
2749 throw XML::SAX::Exception::NotRecognized(
2750 Message => "The feature '$feat' is not recognized by " . ref($self),
2754 #-------------------------------------------------------------------#
2756 #-------------------------------------------------------------------#
2757 # get_handler and friends
2758 #-------------------------------------------------------------------#
2761 my $handler_type = shift;
2762 $handler_type ||= 'Handler';
2763 return defined( $self->{$handler_type} ) ? $self->{$handler_type} : undef;
2766 sub get_document_handler {
2768 return $self->get_handler('DocumentHandler', @_);
2771 sub get_content_handler {
2773 return $self->get_handler('ContentHandler', @_);
2776 sub get_dtd_handler {
2778 return $self->get_handler('DTDHandler', @_);
2781 sub get_lexical_handler {
2783 return $self->get_handler('LexicalHandler', @_);
2786 sub get_decl_handler {
2788 return $self->get_handler('DeclHandler', @_);
2791 sub get_error_handler {
2793 return $self->get_handler('ErrorHandler', @_);
2796 sub get_entity_resolver {
2798 return $self->get_handler('EntityResolver', @_);
2800 #-------------------------------------------------------------------#
2802 #-------------------------------------------------------------------#
2803 # set_handler and friends
2804 #-------------------------------------------------------------------#
2807 my ($new_handler, $handler_type) = reverse @_;
2808 $handler_type ||= 'Handler';
2809 $self->{Methods} = {} if $self->{Methods};
2810 $self->{$handler_type} = $new_handler;
2811 $self->{ParseOptions}->{$handler_type} = $new_handler;
2815 sub set_document_handler {
2817 return $self->set_handler('DocumentHandler', @_);
2820 sub set_content_handler {
2822 return $self->set_handler('ContentHandler', @_);
2824 sub set_dtd_handler {
2826 return $self->set_handler('DTDHandler', @_);
2828 sub set_lexical_handler {
2830 return $self->set_handler('LexicalHandler', @_);
2832 sub set_decl_handler {
2834 return $self->set_handler('DeclHandler', @_);
2836 sub set_error_handler {
2838 return $self->set_handler('ErrorHandler', @_);
2840 sub set_entity_resolver {
2842 return $self->set_handler('EntityResolver', @_);
2845 #-------------------------------------------------------------------#
2847 #-------------------------------------------------------------------#
2848 # supported_features
2849 #-------------------------------------------------------------------#
2850 sub supported_features {
2852 # Only namespaces are required by all parsers
2854 'http://xml.org/sax/features/namespaces',
2857 #-------------------------------------------------------------------#
2860 # this space intentionally blank
2864 package XML::SAX::Base::NoHandler;
2866 # we need a fake handler that doesn't implement anything, this
2867 # simplifies the code a lot (though given the recent changes,
2868 # it may be better to do without)
2870 #warn "no handler called\n";
2880 XML::SAX::Base - Base class SAX Drivers and Filters
2886 @ISA = ('XML::SAX::Base');
2890 This module has a very simple task - to be a base class for PerlSAX
2891 drivers and filters. It's default behaviour is to pass the input directly
2892 to the output unchanged. It can be useful to use this module as a base class
2893 so you don't have to, for example, implement the characters() callback.
2895 The main advantages that it provides are easy dispatching of events the right
2896 way (ie it takes care for you of checking that the handler has implemented
2897 that method, or has defined an AUTOLOAD), and the guarantee that filters
2898 will pass along events that they aren't implementing to handlers downstream
2899 that might nevertheless be interested in them.
2901 =head1 WRITING SAX DRIVERS AND FILTERS
2903 Writing SAX Filters is tremendously easy: all you need to do is
2904 inherit from this module, and define the events you want to handle. A
2905 more detailed explanation can be found at
2906 http://www.xml.com/pub/a/2001/10/10/sax-filters.html.
2908 Writing Drivers is equally simple. The one thing you need to pay
2909 attention to is B<NOT> to call events yourself (this applies to Filters
2910 as well). For instance:
2913 use base qw(XML::SAX::Base);
2919 $self->{Handler}->start_element($data); # BAD
2922 The above example works well as precisely that: an example. But it has
2923 several faults: 1) it doesn't test to see whether the handler defines
2924 start_element. Perhaps it doesn't want to see that event, in which
2925 case you shouldn't throw it (otherwise it'll die). 2) it doesn't check
2926 ContentHandler and then Handler (ie it doesn't look to see that the
2927 user hasn't requested events on a specific handler, and if not on the
2928 default one), 3) if it did check all that, not only would the code be
2929 cumbersome (see this module's source to get an idea) but it would also
2930 probably have to check for a DocumentHandler (in case this were SAX1)
2931 and for AUTOLOADs potentially defined in all these packages. As you can
2932 tell, that would be fairly painful. Instead of going through that,
2933 simply remember to use code similar to the following instead:
2936 use base qw(XML::SAX::Base);
2941 # do something to filter
2942 $self->SUPER::start_element($data); # GOOD (and easy) !
2945 This way, once you've done your job you hand the ball back to
2946 XML::SAX::Base and it takes care of all those problems for you!
2948 Note that the above example doesn't apply to filters only, drivers
2949 will benefit from the exact same feature.
2953 A number of methods are defined within this class for the purpose of
2954 inheritance. Some probably don't need to be overridden (eg parse_file)
2955 but some clearly should be (eg parse). Options for these methods are
2956 described in the PerlSAX2 specification available from
2957 http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/~checkout~/perl-xml/libxml-perl/doc/sax-2.0.html?rev=HEAD&content-type=text/html.
2963 The parse method is the main entry point to parsing documents. Internally
2964 the parse method will detect what type of "thing" you are parsing, and
2965 call the appropriate method in your implementation class. Here is the
2966 mapping table of what is in the Source options (see the Perl SAX 2.0
2967 specification for the meaning of these values):
2969 Source Contains parse() calls
2970 =============== =============
2971 CharacterStream (*) _parse_characterstream($stream, $options)
2972 ByteStream _parse_bytestream($stream, $options)
2973 String _parse_string($string, $options)
2974 SystemId _parse_systemid($string, $options)
2976 However note that these methods may not be sensible if your driver class
2977 is not for parsing XML. An example might be a DBI driver that generates
2978 XML/SAX from a database table. If that is the case, you likely want to
2979 write your own parse() method.
2981 Also note that the Source may contain both a PublicId entry, and an
2982 Encoding entry. To get at these, examine $options->{Source} as passed
2985 (*) A CharacterStream is a filehandle that does not need any encoding
2986 translation done on it. This is implemented as a regular filehandle
2987 and only works under Perl 5.7.2 or higher using PerlIO. To get a single
2988 character, or number of characters from it, use the perl core read()
2989 function. To get a single byte from it (or number of bytes), you can
2990 use sysread(). The encoding of the stream should be in the Encoding
2991 entry for the Source.
2993 =item * parse_file, parse_uri, parse_string
2995 These are all convenience variations on parse(), and in fact simply
2996 set up the options before calling it. You probably don't need to
3001 This is a convenience method to get options in SAX2 style, or more
3002 generically either as hashes or as hashrefs (it returns a hashref).
3003 You will probably want to use this method in your own implementations
3004 of parse() and of new().
3006 =item * get_feature, set_feature
3008 These simply get and set features, and throw the
3009 appropriate exceptions defined in the specification if need be.
3011 If your subclass defines features not defined in this one,
3012 then you should override these methods in such a way that they check for
3013 your features first, and then call the base class's methods
3014 for features not defined by your class. An example would be:
3019 if (exists $MY_FEATURES{$feat}) {
3020 # handle the feature in various ways
3023 return $self->SUPER::get_feature($feat);
3027 Currently this part is unimplemented.
3032 This method takes a handler type (Handler, ContentHandler, etc.) and a
3033 handler object as arguments, and changes the current handler for that
3034 handler type, while taking care of resetting the internal state that
3035 needs to be reset. This allows one to change a handler during parse
3036 without running into problems (changing it on the parser object
3037 directly will most likely cause trouble).
3039 =item * set_document_handler, set_content_handler, set_dtd_handler, set_lexical_handler, set_decl_handler, set_error_handler, set_entity_resolver
3041 These are just simple wrappers around the former method, and take a
3042 handler object as their argument. Internally they simply call
3043 set_handler with the correct arguments.
3047 The inverse of set_handler, this method takes a an optional string containing a handler type (DTDHandler,
3048 ContentHandler, etc. 'Handler' is used if no type is passed). It returns a reference to the object that implements
3049 that that class, or undef if that handler type is not set for the current driver/filter.
3051 =item * get_document_handler, get_content_handler, get_dtd_handler, get_lexical_handler, get_decl_handler,
3052 get_error_handler, get_entity_resolver
3054 These are just simple wrappers around the get_handler() method, and take no arguments. Internally
3055 they simply call get_handler with the correct handler type name.
3059 It would be rather useless to describe all the methods that this
3060 module implements here. They are all the methods supported in SAX1 and
3061 SAX2. In case your memory is a little short, here is a list. The
3062 apparent duplicates are there so that both versions of SAX can be
3067 =item * start_document
3069 =item * end_document
3071 =item * start_element
3073 =item * start_document
3075 =item * end_document
3077 =item * start_element
3083 =item * processing_instruction
3085 =item * ignorable_whitespace
3087 =item * set_document_locator
3089 =item * start_prefix_mapping
3091 =item * end_prefix_mapping
3093 =item * skipped_entity
3101 =item * entity_reference
3103 =item * notation_decl
3105 =item * unparsed_entity_decl
3107 =item * element_decl
3109 =item * attlist_decl
3111 =item * doctype_decl
3117 =item * attribute_decl
3119 =item * internal_entity_decl
3121 =item * external_entity_decl
3123 =item * resolve_entity
3129 =item * start_entity
3144 - conform to the "SAX Filters" and "Java and DOM compatibility"
3145 sections of the SAX2 document.
3149 Kip Hampton (khampton@totalcinema.com) did most of the work, after porting
3150 it from XML::Filter::Base.
3152 Robin Berjon (robin@knowscape.com) pitched in with patches to make it
3153 usable as a base for drivers as well as filters, along with other patches.
3155 Matt Sergeant (matt@sergeant.org) wrote the original XML::Filter::Base,
3156 and patched a few things here and there, and imported it into
3157 the XML::SAX distribution.