File Coverage

blib/lib/XML/SAX/Base.pm
Criterion Covered Total %
statement 903 1366 66.1
branch 479 690 69.4
condition 458 785 58.3
subroutine 47 250 18.8
pod 56 60 93.3
total 1943 3151 61.6


line stmt bran cond sub pod time code
1             package XML::SAX::Base;
2             $XML::SAX::Base::VERSION = '1.09';
3             # version 0.10 - Kip Hampton
4             # version 0.13 - Robin Berjon
5             # version 0.15 - Kip Hampton
6             # version 0.17 - Kip Hampton
7             # version 0.19 - Kip Hampton
8             # version 0.21 - Kip Hampton
9             # version 0.22 - Robin Berjon
10             # version 0.23 - Matt Sergeant
11             # version 0.24 - Robin Berjon
12             # version 0.25 - Kip Hampton
13             # version 1.00 - Kip Hampton
14             # version 1.01 - Kip Hampton
15             # version 1.02 - Robin Berjon
16             # version 1.03 - Matt Sergeant
17             # version 1.04 - Kip Hampton
18             # version 1.05 - Grant McLean
19             # version 1.06 - Grant McLean
20             # version 1.07 - Grant McLean
21             # version 1.08 - Grant McLean
22              
23             #-----------------------------------------------------#
24             # STOP!!!!!
25             #
26             # This file is generated by the 'BuildSAXBase.pl' file
27             # that ships with the XML::SAX::Base distribution.
28             # If you need to make changes, patch that file NOT
29             # XML/SAX/Base.pm Better yet, fork the git repository
30             # commit your changes and send a pull request:
31             # https://github.com/grantm/XML-SAX-Base
32             #-----------------------------------------------------#
33              
34 17     17   80988 use strict;
  17         25  
  17         441  
35              
36 17     17   5223 use XML::SAX::Exception qw();
  17         26  
  17         217749  
37              
38             sub end_entity {
39 7     7 1 39 my $self = shift;
40 7 50       18 if (defined $self->{Methods}->{'end_entity'}) {
41 0         0 $self->{Methods}->{'end_entity'}->(@_);
42             }
43             else {
44 7         6 my $method;
45             my $callbacks;
46 7 50       12 if (exists $self->{ParseOptions}) {
47 0         0 $callbacks = $self->{ParseOptions};
48             }
49             else {
50 7         9 $callbacks = $self;
51             }
52 7 100 100     127 if (0) { # dummy to make elsif's below compile
    100 66        
    100 50        
    50 66        
      33        
      50        
      33        
53             }
54 0 100       0 elsif (defined $callbacks->{'LexicalHandler'} and $method = $callbacks->{'LexicalHandler'}->can('end_entity') ) {
55 2         3 my $handler = $callbacks->{'LexicalHandler'};
56 2     0   8 $self->{Methods}->{'end_entity'} = sub { $method->($handler, @_) };
  0         0  
57 2         12 return $method->($handler, @_);
58             }
59             elsif (defined $callbacks->{'Handler'} and $method = $callbacks->{'Handler'}->can('end_entity') ) {
60 3         5 my $handler = $callbacks->{'Handler'};
61 3     0   8 $self->{Methods}->{'end_entity'} = sub { $method->($handler, @_) };
  0         0  
62 3         11 return $method->($handler, @_);
63             }
64             elsif (defined $callbacks->{'LexicalHandler'}
65             and $callbacks->{'LexicalHandler'}->can('AUTOLOAD')
66             and $callbacks->{'LexicalHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
67             )
68             {
69 1         2 my $res = eval { $callbacks->{'LexicalHandler'}->end_entity(@_) };
  1         3  
70 1 50       50 if ($@) {
71 0         0 die $@;
72             }
73             else {
74             # I think there's a buggette here...
75             # if the first call throws an exception, we don't set it up right.
76             # Not fatal, but we might want to address it.
77 1         2 my $handler = $callbacks->{'LexicalHandler'};
78 1     0   6 $self->{Methods}->{'end_entity'} = sub { $handler->end_entity(@_) };
  0         0  
79             }
80 1         6 return $res;
81             }
82             elsif (defined $callbacks->{'Handler'}
83             and $callbacks->{'Handler'}->can('AUTOLOAD')
84             and $callbacks->{'Handler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
85             )
86             {
87 1         2 my $res = eval { $callbacks->{'Handler'}->end_entity(@_) };
  1         7  
88 1 50       65 if ($@) {
89 0         0 die $@;
90             }
91             else {
92             # I think there's a buggette here...
93             # if the first call throws an exception, we don't set it up right.
94             # Not fatal, but we might want to address it.
95 1         3 my $handler = $callbacks->{'Handler'};
96 1     0   5 $self->{Methods}->{'end_entity'} = sub { $handler->end_entity(@_) };
  0         0  
97             }
98 1         3 return $res;
99             }
100             else {
101 0     0   0 $self->{Methods}->{'end_entity'} = sub { };
102             }
103             }
104              
105             }
106              
107             sub set_document_locator {
108 12     12 1 58 my $self = shift;
109 12 50       31 if (defined $self->{Methods}->{'set_document_locator'}) {
110 0         0 $self->{Methods}->{'set_document_locator'}->(@_);
111             }
112             else {
113 12         14 my $method;
114             my $callbacks;
115 12 50       23 if (exists $self->{ParseOptions}) {
116 0         0 $callbacks = $self->{ParseOptions};
117             }
118             else {
119 12         12 $callbacks = $self;
120             }
121 12 100 100     277 if (0) { # dummy to make elsif's below compile
    100 100        
    100 66        
    100 50        
    100 66        
    50 66        
      50        
      66        
      33        
      50        
      33        
122             }
123 0 100       0 elsif (defined $callbacks->{'ContentHandler'} and $method = $callbacks->{'ContentHandler'}->can('set_document_locator') ) {
124 2         3 my $handler = $callbacks->{'ContentHandler'};
125 2     0   8 $self->{Methods}->{'set_document_locator'} = sub { $method->($handler, @_) };
  0         0  
126 2         12 return $method->($handler, @_);
127             }
128             elsif (defined $callbacks->{'DocumentHandler'} and $method = $callbacks->{'DocumentHandler'}->can('set_document_locator') ) {
129 2         3 my $handler = $callbacks->{'DocumentHandler'};
130 2     0   7 $self->{Methods}->{'set_document_locator'} = sub { $method->($handler, @_) };
  0         0  
131 2         18 return $method->($handler, @_);
132             }
133             elsif (defined $callbacks->{'Handler'} and $method = $callbacks->{'Handler'}->can('set_document_locator') ) {
134 3         5 my $handler = $callbacks->{'Handler'};
135 3     0   7 $self->{Methods}->{'set_document_locator'} = sub { $method->($handler, @_) };
  0         0  
136 3         17 return $method->($handler, @_);
137             }
138             elsif (defined $callbacks->{'ContentHandler'}
139             and $callbacks->{'ContentHandler'}->can('AUTOLOAD')
140             and $callbacks->{'ContentHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
141             )
142             {
143 2         4 my $res = eval { $callbacks->{'ContentHandler'}->set_document_locator(@_) };
  2         7  
144 2 50       17 if ($@) {
145 0         0 die $@;
146             }
147             else {
148             # I think there's a buggette here...
149             # if the first call throws an exception, we don't set it up right.
150             # Not fatal, but we might want to address it.
151 2         3 my $handler = $callbacks->{'ContentHandler'};
152 2     0   7 $self->{Methods}->{'set_document_locator'} = sub { $handler->set_document_locator(@_) };
  0         0  
153             }
154 2         5 return $res;
155             }
156             elsif (defined $callbacks->{'DocumentHandler'}
157             and $callbacks->{'DocumentHandler'}->can('AUTOLOAD')
158             and $callbacks->{'DocumentHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
159             )
160             {
161 1         2 my $res = eval { $callbacks->{'DocumentHandler'}->set_document_locator(@_) };
  1         5  
162 1 50       154 if ($@) {
163 0         0 die $@;
164             }
165             else {
166             # I think there's a buggette here...
167             # if the first call throws an exception, we don't set it up right.
168             # Not fatal, but we might want to address it.
169 1         3 my $handler = $callbacks->{'DocumentHandler'};
170 1     0   6 $self->{Methods}->{'set_document_locator'} = sub { $handler->set_document_locator(@_) };
  0         0  
171             }
172 1         3 return $res;
173             }
174             elsif (defined $callbacks->{'Handler'}
175             and $callbacks->{'Handler'}->can('AUTOLOAD')
176             and $callbacks->{'Handler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
177             )
178             {
179 2         3 my $res = eval { $callbacks->{'Handler'}->set_document_locator(@_) };
  2         12  
180 2 50       219 if ($@) {
181 0         0 die $@;
182             }
183             else {
184             # I think there's a buggette here...
185             # if the first call throws an exception, we don't set it up right.
186             # Not fatal, but we might want to address it.
187 2         5 my $handler = $callbacks->{'Handler'};
188 2     0   10 $self->{Methods}->{'set_document_locator'} = sub { $handler->set_document_locator(@_) };
  0         0  
189             }
190 2         7 return $res;
191             }
192             else {
193 0     0   0 $self->{Methods}->{'set_document_locator'} = sub { };
194             }
195             }
196              
197             }
198              
199             sub notation_decl {
200 6     6 1 38 my $self = shift;
201 6 50       17 if (defined $self->{Methods}->{'notation_decl'}) {
202 0         0 $self->{Methods}->{'notation_decl'}->(@_);
203             }
204             else {
205 6         5 my $method;
206             my $callbacks;
207 6 50       11 if (exists $self->{ParseOptions}) {
208 0         0 $callbacks = $self->{ParseOptions};
209             }
210             else {
211 6         6 $callbacks = $self;
212             }
213 6 100 66     181 if (0) { # dummy to make elsif's below compile
    50 66        
    100 50        
    50 66        
      33        
      50        
      33        
214             }
215 0 100       0 elsif (defined $callbacks->{'DTDHandler'} and $method = $callbacks->{'DTDHandler'}->can('notation_decl') ) {
216 3         5 my $handler = $callbacks->{'DTDHandler'};
217 3     0   19 $self->{Methods}->{'notation_decl'} = sub { $method->($handler, @_) };
  0         0  
218 3         18 return $method->($handler, @_);
219             }
220             elsif (defined $callbacks->{'Handler'} and $method = $callbacks->{'Handler'}->can('notation_decl') ) {
221 0         0 my $handler = $callbacks->{'Handler'};
222 0     0   0 $self->{Methods}->{'notation_decl'} = sub { $method->($handler, @_) };
  0         0  
223 0         0 return $method->($handler, @_);
224             }
225             elsif (defined $callbacks->{'DTDHandler'}
226             and $callbacks->{'DTDHandler'}->can('AUTOLOAD')
227             and $callbacks->{'DTDHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
228             )
229             {
230 1         1 my $res = eval { $callbacks->{'DTDHandler'}->notation_decl(@_) };
  1         5  
231 1 50       82 if ($@) {
232 0         0 die $@;
233             }
234             else {
235             # I think there's a buggette here...
236             # if the first call throws an exception, we don't set it up right.
237             # Not fatal, but we might want to address it.
238 1         11 my $handler = $callbacks->{'DTDHandler'};
239 1     0   4 $self->{Methods}->{'notation_decl'} = sub { $handler->notation_decl(@_) };
  0         0  
240             }
241 1         3 return $res;
242             }
243             elsif (defined $callbacks->{'Handler'}
244             and $callbacks->{'Handler'}->can('AUTOLOAD')
245             and $callbacks->{'Handler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
246             )
247             {
248 2         5 my $res = eval { $callbacks->{'Handler'}->notation_decl(@_) };
  2         12  
249 2 50       210 if ($@) {
250 0         0 die $@;
251             }
252             else {
253             # I think there's a buggette here...
254             # if the first call throws an exception, we don't set it up right.
255             # Not fatal, but we might want to address it.
256 2         4 my $handler = $callbacks->{'Handler'};
257 2     0   9 $self->{Methods}->{'notation_decl'} = sub { $handler->notation_decl(@_) };
  0         0  
258             }
259 2         6 return $res;
260             }
261             else {
262 0     0   0 $self->{Methods}->{'notation_decl'} = sub { };
263             }
264             }
265              
266             }
267              
268             sub attlist_decl {
269 9     9 1 44 my $self = shift;
270 9 50       20 if (defined $self->{Methods}->{'attlist_decl'}) {
271 0         0 $self->{Methods}->{'attlist_decl'}->(@_);
272             }
273             else {
274 9         13 my $method;
275             my $callbacks;
276 9 50       15 if (exists $self->{ParseOptions}) {
277 0         0 $callbacks = $self->{ParseOptions};
278             }
279             else {
280 9         9 $callbacks = $self;
281             }
282 9 100 100     160 if (0) { # dummy to make elsif's below compile
    100 66        
    100 50        
    50 66        
      33        
      50        
      33        
283             }
284 0 100       0 elsif (defined $callbacks->{'DTDHandler'} and $method = $callbacks->{'DTDHandler'}->can('attlist_decl') ) {
285 3         6 my $handler = $callbacks->{'DTDHandler'};
286 3     0   15 $self->{Methods}->{'attlist_decl'} = sub { $method->($handler, @_) };
  0         0  
287 3         16 return $method->($handler, @_);
288             }
289             elsif (defined $callbacks->{'Handler'} and $method = $callbacks->{'Handler'}->can('attlist_decl') ) {
290 3         4 my $handler = $callbacks->{'Handler'};
291 3     0   8 $self->{Methods}->{'attlist_decl'} = sub { $method->($handler, @_) };
  0         0  
292 3         11 return $method->($handler, @_);
293             }
294             elsif (defined $callbacks->{'DTDHandler'}
295             and $callbacks->{'DTDHandler'}->can('AUTOLOAD')
296             and $callbacks->{'DTDHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
297             )
298             {
299 1         2 my $res = eval { $callbacks->{'DTDHandler'}->attlist_decl(@_) };
  1         4  
300 1 50       31 if ($@) {
301 0         0 die $@;
302             }
303             else {
304             # I think there's a buggette here...
305             # if the first call throws an exception, we don't set it up right.
306             # Not fatal, but we might want to address it.
307 1         2 my $handler = $callbacks->{'DTDHandler'};
308 1     0   3 $self->{Methods}->{'attlist_decl'} = sub { $handler->attlist_decl(@_) };
  0         0  
309             }
310 1         2 return $res;
311             }
312             elsif (defined $callbacks->{'Handler'}
313             and $callbacks->{'Handler'}->can('AUTOLOAD')
314             and $callbacks->{'Handler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
315             )
316             {
317 2         3 my $res = eval { $callbacks->{'Handler'}->attlist_decl(@_) };
  2         13  
318 2 50       202 if ($@) {
319 0         0 die $@;
320             }
321             else {
322             # I think there's a buggette here...
323             # if the first call throws an exception, we don't set it up right.
324             # Not fatal, but we might want to address it.
325 2         4 my $handler = $callbacks->{'Handler'};
326 2     0   10 $self->{Methods}->{'attlist_decl'} = sub { $handler->attlist_decl(@_) };
  0         0  
327             }
328 2         6 return $res;
329             }
330             else {
331 0     0   0 $self->{Methods}->{'attlist_decl'} = sub { };
332             }
333             }
334              
335             }
336              
337             sub fatal_error {
338 7     7 1 30 my $self = shift;
339 7 50       25 if (defined $self->{Methods}->{'fatal_error'}) {
340 0         0 $self->{Methods}->{'fatal_error'}->(@_);
341             }
342             else {
343 7         9 my $method;
344             my $callbacks;
345 7 50       15 if (exists $self->{ParseOptions}) {
346 0         0 $callbacks = $self->{ParseOptions};
347             }
348             else {
349 7         5 $callbacks = $self;
350             }
351 7 100 100     122 if (0) { # dummy to make elsif's below compile
    100 66        
    100 50        
    50 66        
      33        
      50        
      33        
352             }
353 0 100       0 elsif (defined $callbacks->{'ErrorHandler'} and $method = $callbacks->{'ErrorHandler'}->can('fatal_error') ) {
354 2         3 my $handler = $callbacks->{'ErrorHandler'};
355 2     0   9 $self->{Methods}->{'fatal_error'} = sub { $method->($handler, @_) };
  0         0  
356 2         21 return $method->($handler, @_);
357             }
358             elsif (defined $callbacks->{'Handler'} and $method = $callbacks->{'Handler'}->can('fatal_error') ) {
359 3         3 my $handler = $callbacks->{'Handler'};
360 3     0   9 $self->{Methods}->{'fatal_error'} = sub { $method->($handler, @_) };
  0         0  
361 3         8 return $method->($handler, @_);
362             }
363             elsif (defined $callbacks->{'ErrorHandler'}
364             and $callbacks->{'ErrorHandler'}->can('AUTOLOAD')
365             and $callbacks->{'ErrorHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
366             )
367             {
368 1         2 my $res = eval { $callbacks->{'ErrorHandler'}->fatal_error(@_) };
  1         4  
369 1 50       34 if ($@) {
370 0         0 die $@;
371             }
372             else {
373             # I think there's a buggette here...
374             # if the first call throws an exception, we don't set it up right.
375             # Not fatal, but we might want to address it.
376 1         1 my $handler = $callbacks->{'ErrorHandler'};
377 1     0   3 $self->{Methods}->{'fatal_error'} = sub { $handler->fatal_error(@_) };
  0         0  
378             }
379 1         5 return $res;
380             }
381             elsif (defined $callbacks->{'Handler'}
382             and $callbacks->{'Handler'}->can('AUTOLOAD')
383             and $callbacks->{'Handler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
384             )
385             {
386 1         2 my $res = eval { $callbacks->{'Handler'}->fatal_error(@_) };
  1         7  
387 1 50       66 if ($@) {
388 0         0 die $@;
389             }
390             else {
391             # I think there's a buggette here...
392             # if the first call throws an exception, we don't set it up right.
393             # Not fatal, but we might want to address it.
394 1         3 my $handler = $callbacks->{'Handler'};
395 1     0   6 $self->{Methods}->{'fatal_error'} = sub { $handler->fatal_error(@_) };
  0         0  
396             }
397 1         3 return $res;
398             }
399             else {
400 0     0   0 $self->{Methods}->{'fatal_error'} = sub { };
401             }
402             }
403              
404             }
405              
406             sub start_document {
407 12     12 1 150 my $self = shift;
408 12 50       35 if (defined $self->{Methods}->{'start_document'}) {
409 0         0 $self->{Methods}->{'start_document'}->(@_);
410             }
411             else {
412 12         13 my $method;
413             my $callbacks;
414 12 50       27 if (exists $self->{ParseOptions}) {
415 0         0 $callbacks = $self->{ParseOptions};
416             }
417             else {
418 12         12 $callbacks = $self;
419             }
420 12 100 100     285 if (0) { # dummy to make elsif's below compile
    100 100        
    100 66        
    100 50        
    100 66        
    50 66        
      50        
      66        
      33        
      50        
      33        
421             }
422 0 100       0 elsif (defined $callbacks->{'ContentHandler'} and $method = $callbacks->{'ContentHandler'}->can('start_document') ) {
423 2         3 my $handler = $callbacks->{'ContentHandler'};
424 2     0   10 $self->{Methods}->{'start_document'} = sub { $method->($handler, @_) };
  0         0  
425 2         15 return $method->($handler, @_);
426             }
427             elsif (defined $callbacks->{'DocumentHandler'} and $method = $callbacks->{'DocumentHandler'}->can('start_document') ) {
428 2         4 my $handler = $callbacks->{'DocumentHandler'};
429 2     0   9 $self->{Methods}->{'start_document'} = sub { $method->($handler, @_) };
  0         0  
430 2         14 return $method->($handler, @_);
431             }
432             elsif (defined $callbacks->{'Handler'} and $method = $callbacks->{'Handler'}->can('start_document') ) {
433 3         5 my $handler = $callbacks->{'Handler'};
434 3     0   16 $self->{Methods}->{'start_document'} = sub { $method->($handler, @_) };
  0         0  
435 3         21 return $method->($handler, @_);
436             }
437             elsif (defined $callbacks->{'ContentHandler'}
438             and $callbacks->{'ContentHandler'}->can('AUTOLOAD')
439             and $callbacks->{'ContentHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
440             )
441             {
442 2         3 my $res = eval { $callbacks->{'ContentHandler'}->start_document(@_) };
  2         12  
443 2 50       31 if ($@) {
444 0         0 die $@;
445             }
446             else {
447             # I think there's a buggette here...
448             # if the first call throws an exception, we don't set it up right.
449             # Not fatal, but we might want to address it.
450 2         11 my $handler = $callbacks->{'ContentHandler'};
451 2     0   12 $self->{Methods}->{'start_document'} = sub { $handler->start_document(@_) };
  0         0  
452             }
453 2         6 return $res;
454             }
455             elsif (defined $callbacks->{'DocumentHandler'}
456             and $callbacks->{'DocumentHandler'}->can('AUTOLOAD')
457             and $callbacks->{'DocumentHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
458             )
459             {
460 1         2 my $res = eval { $callbacks->{'DocumentHandler'}->start_document(@_) };
  1         5  
461 1 50       349 if ($@) {
462 0         0 die $@;
463             }
464             else {
465             # I think there's a buggette here...
466             # if the first call throws an exception, we don't set it up right.
467             # Not fatal, but we might want to address it.
468 1         11 my $handler = $callbacks->{'DocumentHandler'};
469 1     0   4 $self->{Methods}->{'start_document'} = sub { $handler->start_document(@_) };
  0         0  
470             }
471 1         3 return $res;
472             }
473             elsif (defined $callbacks->{'Handler'}
474             and $callbacks->{'Handler'}->can('AUTOLOAD')
475             and $callbacks->{'Handler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
476             )
477             {
478 2         2 my $res = eval { $callbacks->{'Handler'}->start_document(@_) };
  2         12  
479 2 50       443 if ($@) {
480 0         0 die $@;
481             }
482             else {
483             # I think there's a buggette here...
484             # if the first call throws an exception, we don't set it up right.
485             # Not fatal, but we might want to address it.
486 2         34 my $handler = $callbacks->{'Handler'};
487 2     0   14 $self->{Methods}->{'start_document'} = sub { $handler->start_document(@_) };
  0         0  
488             }
489 2         8 return $res;
490             }
491             else {
492 0     0   0 $self->{Methods}->{'start_document'} = sub { };
493             }
494             }
495              
496             }
497              
498             sub warning {
499 7     7 1 43 my $self = shift;
500 7 50       17 if (defined $self->{Methods}->{'warning'}) {
501 0         0 $self->{Methods}->{'warning'}->(@_);
502             }
503             else {
504 7         8 my $method;
505             my $callbacks;
506 7 50       15 if (exists $self->{ParseOptions}) {
507 0         0 $callbacks = $self->{ParseOptions};
508             }
509             else {
510 7         10 $callbacks = $self;
511             }
512 7 100 100     134 if (0) { # dummy to make elsif's below compile
    100 66        
    100 50        
    50 66        
      33        
      50        
      33        
513             }
514 0 100       0 elsif (defined $callbacks->{'ErrorHandler'} and $method = $callbacks->{'ErrorHandler'}->can('warning') ) {
515 2         3 my $handler = $callbacks->{'ErrorHandler'};
516 2     0   15 $self->{Methods}->{'warning'} = sub { $method->($handler, @_) };
  0         0  
517 2         15 return $method->($handler, @_);
518             }
519             elsif (defined $callbacks->{'Handler'} and $method = $callbacks->{'Handler'}->can('warning') ) {
520 3         3 my $handler = $callbacks->{'Handler'};
521 3     0   11 $self->{Methods}->{'warning'} = sub { $method->($handler, @_) };
  0         0  
522 3         9 return $method->($handler, @_);
523             }
524             elsif (defined $callbacks->{'ErrorHandler'}
525             and $callbacks->{'ErrorHandler'}->can('AUTOLOAD')
526             and $callbacks->{'ErrorHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
527             )
528             {
529 1         2 my $res = eval { $callbacks->{'ErrorHandler'}->warning(@_) };
  1         5  
530 1 50       78 if ($@) {
531 0         0 die $@;
532             }
533             else {
534             # I think there's a buggette here...
535             # if the first call throws an exception, we don't set it up right.
536             # Not fatal, but we might want to address it.
537 1         10 my $handler = $callbacks->{'ErrorHandler'};
538 1     0   4 $self->{Methods}->{'warning'} = sub { $handler->warning(@_) };
  0         0  
539             }
540 1         3 return $res;
541             }
542             elsif (defined $callbacks->{'Handler'}
543             and $callbacks->{'Handler'}->can('AUTOLOAD')
544             and $callbacks->{'Handler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
545             )
546             {
547 1         2 my $res = eval { $callbacks->{'Handler'}->warning(@_) };
  1         7  
548 1 50       66 if ($@) {
549 0         0 die $@;
550             }
551             else {
552             # I think there's a buggette here...
553             # if the first call throws an exception, we don't set it up right.
554             # Not fatal, but we might want to address it.
555 1         2 my $handler = $callbacks->{'Handler'};
556 1     0   5 $self->{Methods}->{'warning'} = sub { $handler->warning(@_) };
  0         0  
557             }
558 1         4 return $res;
559             }
560             else {
561 0     0   0 $self->{Methods}->{'warning'} = sub { };
562             }
563             }
564              
565             }
566              
567             sub ignorable_whitespace {
568 12     12 1 53 my $self = shift;
569 12 50       34 if (defined $self->{Methods}->{'ignorable_whitespace'}) {
570 0         0 $self->{Methods}->{'ignorable_whitespace'}->(@_);
571             }
572             else {
573 12         14 my $method;
574             my $callbacks;
575 12 50       28 if (exists $self->{ParseOptions}) {
576 0         0 $callbacks = $self->{ParseOptions};
577             }
578             else {
579 12         11 $callbacks = $self;
580             }
581 12 100 100     281 if (0) { # dummy to make elsif's below compile
    100 100        
    100 66        
    100 50        
    100 66        
    50 66        
      50        
      66        
      33        
      50        
      33        
582             }
583 0 100       0 elsif (defined $callbacks->{'ContentHandler'} and $method = $callbacks->{'ContentHandler'}->can('ignorable_whitespace') ) {
584 2         3 my $handler = $callbacks->{'ContentHandler'};
585 2     0   10 $self->{Methods}->{'ignorable_whitespace'} = sub { $method->($handler, @_) };
  0         0  
586 2         12 return $method->($handler, @_);
587             }
588             elsif (defined $callbacks->{'DocumentHandler'} and $method = $callbacks->{'DocumentHandler'}->can('ignorable_whitespace') ) {
589 2         3 my $handler = $callbacks->{'DocumentHandler'};
590 2     0   10 $self->{Methods}->{'ignorable_whitespace'} = sub { $method->($handler, @_) };
  0         0  
591 2         12 return $method->($handler, @_);
592             }
593             elsif (defined $callbacks->{'Handler'} and $method = $callbacks->{'Handler'}->can('ignorable_whitespace') ) {
594 3         4 my $handler = $callbacks->{'Handler'};
595 3     0   6 $self->{Methods}->{'ignorable_whitespace'} = sub { $method->($handler, @_) };
  0         0  
596 3         11 return $method->($handler, @_);
597             }
598             elsif (defined $callbacks->{'ContentHandler'}
599             and $callbacks->{'ContentHandler'}->can('AUTOLOAD')
600             and $callbacks->{'ContentHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
601             )
602             {
603 2         3 my $res = eval { $callbacks->{'ContentHandler'}->ignorable_whitespace(@_) };
  2         9  
604 2 50       16 if ($@) {
605 0         0 die $@;
606             }
607             else {
608             # I think there's a buggette here...
609             # if the first call throws an exception, we don't set it up right.
610             # Not fatal, but we might want to address it.
611 2         3 my $handler = $callbacks->{'ContentHandler'};
612 2     0   7 $self->{Methods}->{'ignorable_whitespace'} = sub { $handler->ignorable_whitespace(@_) };
  0         0  
613             }
614 2         4 return $res;
615             }
616             elsif (defined $callbacks->{'DocumentHandler'}
617             and $callbacks->{'DocumentHandler'}->can('AUTOLOAD')
618             and $callbacks->{'DocumentHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
619             )
620             {
621 1         1 my $res = eval { $callbacks->{'DocumentHandler'}->ignorable_whitespace(@_) };
  1         5  
622 1 50       178 if ($@) {
623 0         0 die $@;
624             }
625             else {
626             # I think there's a buggette here...
627             # if the first call throws an exception, we don't set it up right.
628             # Not fatal, but we might want to address it.
629 1         2 my $handler = $callbacks->{'DocumentHandler'};
630 1     0   4 $self->{Methods}->{'ignorable_whitespace'} = sub { $handler->ignorable_whitespace(@_) };
  0         0  
631             }
632 1         3 return $res;
633             }
634             elsif (defined $callbacks->{'Handler'}
635             and $callbacks->{'Handler'}->can('AUTOLOAD')
636             and $callbacks->{'Handler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
637             )
638             {
639 2         4 my $res = eval { $callbacks->{'Handler'}->ignorable_whitespace(@_) };
  2         14  
640 2 50       211 if ($@) {
641 0         0 die $@;
642             }
643             else {
644             # I think there's a buggette here...
645             # if the first call throws an exception, we don't set it up right.
646             # Not fatal, but we might want to address it.
647 2         5 my $handler = $callbacks->{'Handler'};
648 2     0   10 $self->{Methods}->{'ignorable_whitespace'} = sub { $handler->ignorable_whitespace(@_) };
  0         0  
649             }
650 2         7 return $res;
651             }
652             else {
653 0     0   0 $self->{Methods}->{'ignorable_whitespace'} = sub { };
654             }
655             }
656              
657             }
658              
659             sub resolve_entity {
660 7     7 1 49 my $self = shift;
661 7 50       19 if (defined $self->{Methods}->{'resolve_entity'}) {
662 0         0 $self->{Methods}->{'resolve_entity'}->(@_);
663             }
664             else {
665 7         8 my $method;
666             my $callbacks;
667 7 50       13 if (exists $self->{ParseOptions}) {
668 0         0 $callbacks = $self->{ParseOptions};
669             }
670             else {
671 7         8 $callbacks = $self;
672             }
673 7 100 66     126 if (0) { # dummy to make elsif's below compile
    100 66        
    100 50        
    50 66        
      33        
      50        
      33        
674             }
675 0 100       0 elsif (defined $callbacks->{'EntityResolver'} and $method = $callbacks->{'EntityResolver'}->can('resolve_entity') ) {
676 2         4 my $handler = $callbacks->{'EntityResolver'};
677 2     0   16 $self->{Methods}->{'resolve_entity'} = sub { $method->($handler, @_) };
  0         0  
678 2         21 return $method->($handler, @_);
679             }
680             elsif (defined $callbacks->{'Handler'} and $method = $callbacks->{'Handler'}->can('resolve_entity') ) {
681 3         5 my $handler = $callbacks->{'Handler'};
682 3     0   9 $self->{Methods}->{'resolve_entity'} = sub { $method->($handler, @_) };
  0         0  
683 3         9 return $method->($handler, @_);
684             }
685             elsif (defined $callbacks->{'EntityResolver'}
686             and $callbacks->{'EntityResolver'}->can('AUTOLOAD')
687             and $callbacks->{'EntityResolver'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
688             )
689             {
690 1         2 my $res = eval { $callbacks->{'EntityResolver'}->resolve_entity(@_) };
  1         16  
691 1 50       375 if ($@) {
692 0         0 die $@;
693             }
694             else {
695             # I think there's a buggette here...
696             # if the first call throws an exception, we don't set it up right.
697             # Not fatal, but we might want to address it.
698 1         4 my $handler = $callbacks->{'EntityResolver'};
699 1     0   5 $self->{Methods}->{'resolve_entity'} = sub { $handler->resolve_entity(@_) };
  0         0  
700             }
701 1         6 return $res;
702             }
703             elsif (defined $callbacks->{'Handler'}
704             and $callbacks->{'Handler'}->can('AUTOLOAD')
705             and $callbacks->{'Handler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
706             )
707             {
708 1         1 my $res = eval { $callbacks->{'Handler'}->resolve_entity(@_) };
  1         7  
709 1 50       64 if ($@) {
710 0         0 die $@;
711             }
712             else {
713             # I think there's a buggette here...
714             # if the first call throws an exception, we don't set it up right.
715             # Not fatal, but we might want to address it.
716 1         3 my $handler = $callbacks->{'Handler'};
717 1     0   6 $self->{Methods}->{'resolve_entity'} = sub { $handler->resolve_entity(@_) };
  0         0  
718             }
719 1         9 return $res;
720             }
721             else {
722 0     0   0 $self->{Methods}->{'resolve_entity'} = sub { };
723             }
724             }
725              
726             }
727              
728             sub external_entity_decl {
729 7     7 1 32 my $self = shift;
730 7 50       21 if (defined $self->{Methods}->{'external_entity_decl'}) {
731 0         0 $self->{Methods}->{'external_entity_decl'}->(@_);
732             }
733             else {
734 7         5 my $method;
735             my $callbacks;
736 7 50       13 if (exists $self->{ParseOptions}) {
737 0         0 $callbacks = $self->{ParseOptions};
738             }
739             else {
740 7         7 $callbacks = $self;
741             }
742 7 100 100     118 if (0) { # dummy to make elsif's below compile
    100 66        
    100 50        
    50 66        
      33        
      50        
      33        
743             }
744 0 100       0 elsif (defined $callbacks->{'DeclHandler'} and $method = $callbacks->{'DeclHandler'}->can('external_entity_decl') ) {
745 2         4 my $handler = $callbacks->{'DeclHandler'};
746 2     0   10 $self->{Methods}->{'external_entity_decl'} = sub { $method->($handler, @_) };
  0         0  
747 2         21 return $method->($handler, @_);
748             }
749             elsif (defined $callbacks->{'Handler'} and $method = $callbacks->{'Handler'}->can('external_entity_decl') ) {
750 3         4 my $handler = $callbacks->{'Handler'};
751 3     0   7 $self->{Methods}->{'external_entity_decl'} = sub { $method->($handler, @_) };
  0         0  
752 3         10 return $method->($handler, @_);
753             }
754             elsif (defined $callbacks->{'DeclHandler'}
755             and $callbacks->{'DeclHandler'}->can('AUTOLOAD')
756             and $callbacks->{'DeclHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
757             )
758             {
759 1         2 my $res = eval { $callbacks->{'DeclHandler'}->external_entity_decl(@_) };
  1         4  
760 1 50       34 if ($@) {
761 0         0 die $@;
762             }
763             else {
764             # I think there's a buggette here...
765             # if the first call throws an exception, we don't set it up right.
766             # Not fatal, but we might want to address it.
767 1         2 my $handler = $callbacks->{'DeclHandler'};
768 1     0   4 $self->{Methods}->{'external_entity_decl'} = sub { $handler->external_entity_decl(@_) };
  0         0  
769             }
770 1         5 return $res;
771             }
772             elsif (defined $callbacks->{'Handler'}
773             and $callbacks->{'Handler'}->can('AUTOLOAD')
774             and $callbacks->{'Handler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
775             )
776             {
777 1         2 my $res = eval { $callbacks->{'Handler'}->external_entity_decl(@_) };
  1         8  
778 1 50       77 if ($@) {
779 0         0 die $@;
780             }
781             else {
782             # I think there's a buggette here...
783             # if the first call throws an exception, we don't set it up right.
784             # Not fatal, but we might want to address it.
785 1         2 my $handler = $callbacks->{'Handler'};
786 1     0   12 $self->{Methods}->{'external_entity_decl'} = sub { $handler->external_entity_decl(@_) };
  0         0  
787             }
788 1         4 return $res;
789             }
790             else {
791 0     0   0 $self->{Methods}->{'external_entity_decl'} = sub { };
792             }
793             }
794              
795             }
796              
797             sub entity_reference {
798 7     7 1 33 my $self = shift;
799 7 50       19 if (defined $self->{Methods}->{'entity_reference'}) {
800 0         0 $self->{Methods}->{'entity_reference'}->(@_);
801             }
802             else {
803 7         9 my $method;
804             my $callbacks;
805 7 50       16 if (exists $self->{ParseOptions}) {
806 0         0 $callbacks = $self->{ParseOptions};
807             }
808             else {
809 7         5 $callbacks = $self;
810             }
811 7 100 100     103 if (0) { # dummy to make elsif's below compile
    100 66        
    100 50        
    50 66        
      33        
      50        
      33        
812             }
813 0 100       0 elsif (defined $callbacks->{'DocumentHandler'} and $method = $callbacks->{'DocumentHandler'}->can('entity_reference') ) {
814 2         4 my $handler = $callbacks->{'DocumentHandler'};
815 2     0   9 $self->{Methods}->{'entity_reference'} = sub { $method->($handler, @_) };
  0         0  
816 2         13 return $method->($handler, @_);
817             }
818             elsif (defined $callbacks->{'Handler'} and $method = $callbacks->{'Handler'}->can('entity_reference') ) {
819 3         4 my $handler = $callbacks->{'Handler'};
820 3     0   10 $self->{Methods}->{'entity_reference'} = sub { $method->($handler, @_) };
  0         0  
821 3         10 return $method->($handler, @_);
822             }
823             elsif (defined $callbacks->{'DocumentHandler'}
824             and $callbacks->{'DocumentHandler'}->can('AUTOLOAD')
825             and $callbacks->{'DocumentHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
826             )
827             {
828 1         1 my $res = eval { $callbacks->{'DocumentHandler'}->entity_reference(@_) };
  1         6  
829 1 50       139 if ($@) {
830 0         0 die $@;
831             }
832             else {
833             # I think there's a buggette here...
834             # if the first call throws an exception, we don't set it up right.
835             # Not fatal, but we might want to address it.
836 1         2 my $handler = $callbacks->{'DocumentHandler'};
837 1     0   11 $self->{Methods}->{'entity_reference'} = sub { $handler->entity_reference(@_) };
  0         0  
838             }
839 1         2 return $res;
840             }
841             elsif (defined $callbacks->{'Handler'}
842             and $callbacks->{'Handler'}->can('AUTOLOAD')
843             and $callbacks->{'Handler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
844             )
845             {
846 1         4 my $res = eval { $callbacks->{'Handler'}->entity_reference(@_) };
  1         5  
847 1 50       136 if ($@) {
848 0         0 die $@;
849             }
850             else {
851             # I think there's a buggette here...
852             # if the first call throws an exception, we don't set it up right.
853             # Not fatal, but we might want to address it.
854 1         1 my $handler = $callbacks->{'Handler'};
855 1     0   6 $self->{Methods}->{'entity_reference'} = sub { $handler->entity_reference(@_) };
  0         0  
856             }
857 1         2 return $res;
858             }
859             else {
860 0     0   0 $self->{Methods}->{'entity_reference'} = sub { };
861             }
862             }
863              
864             }
865              
866             sub start_entity {
867 7     7 1 34 my $self = shift;
868 7 50       15 if (defined $self->{Methods}->{'start_entity'}) {
869 0         0 $self->{Methods}->{'start_entity'}->(@_);
870             }
871             else {
872 7         7 my $method;
873             my $callbacks;
874 7 50       16 if (exists $self->{ParseOptions}) {
875 0         0 $callbacks = $self->{ParseOptions};
876             }
877             else {
878 7         9 $callbacks = $self;
879             }
880 7 100 100     101 if (0) { # dummy to make elsif's below compile
    100 66        
    100 50        
    50 66        
      33        
      50        
      33        
881             }
882 0 100       0 elsif (defined $callbacks->{'LexicalHandler'} and $method = $callbacks->{'LexicalHandler'}->can('start_entity') ) {
883 2         28 my $handler = $callbacks->{'LexicalHandler'};
884 2     0   23 $self->{Methods}->{'start_entity'} = sub { $method->($handler, @_) };
  0         0  
885 2         18 return $method->($handler, @_);
886             }
887             elsif (defined $callbacks->{'Handler'} and $method = $callbacks->{'Handler'}->can('start_entity') ) {
888 3         3 my $handler = $callbacks->{'Handler'};
889 3     0   8 $self->{Methods}->{'start_entity'} = sub { $method->($handler, @_) };
  0         0  
890 3         14 return $method->($handler, @_);
891             }
892             elsif (defined $callbacks->{'LexicalHandler'}
893             and $callbacks->{'LexicalHandler'}->can('AUTOLOAD')
894             and $callbacks->{'LexicalHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
895             )
896             {
897 1         2 my $res = eval { $callbacks->{'LexicalHandler'}->start_entity(@_) };
  1         4  
898 1 50       51 if ($@) {
899 0         0 die $@;
900             }
901             else {
902             # I think there's a buggette here...
903             # if the first call throws an exception, we don't set it up right.
904             # Not fatal, but we might want to address it.
905 1         2 my $handler = $callbacks->{'LexicalHandler'};
906 1     0   4 $self->{Methods}->{'start_entity'} = sub { $handler->start_entity(@_) };
  0         0  
907             }
908 1         2 return $res;
909             }
910             elsif (defined $callbacks->{'Handler'}
911             and $callbacks->{'Handler'}->can('AUTOLOAD')
912             and $callbacks->{'Handler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
913             )
914             {
915 1         2 my $res = eval { $callbacks->{'Handler'}->start_entity(@_) };
  1         7  
916 1 50       66 if ($@) {
917 0         0 die $@;
918             }
919             else {
920             # I think there's a buggette here...
921             # if the first call throws an exception, we don't set it up right.
922             # Not fatal, but we might want to address it.
923 1         3 my $handler = $callbacks->{'Handler'};
924 1     0   6 $self->{Methods}->{'start_entity'} = sub { $handler->start_entity(@_) };
  0         0  
925             }
926 1         3 return $res;
927             }
928             else {
929 0     0   0 $self->{Methods}->{'start_entity'} = sub { };
930             }
931             }
932              
933             }
934              
935             sub end_dtd {
936 7     7 1 32 my $self = shift;
937 7 50       18 if (defined $self->{Methods}->{'end_dtd'}) {
938 0         0 $self->{Methods}->{'end_dtd'}->(@_);
939             }
940             else {
941 7         7 my $method;
942             my $callbacks;
943 7 50       13 if (exists $self->{ParseOptions}) {
944 0         0 $callbacks = $self->{ParseOptions};
945             }
946             else {
947 7         7 $callbacks = $self;
948             }
949 7 100 100     118 if (0) { # dummy to make elsif's below compile
    100 66        
    100 50        
    50 66        
      33        
      50        
      33        
950             }
951 0 100       0 elsif (defined $callbacks->{'LexicalHandler'} and $method = $callbacks->{'LexicalHandler'}->can('end_dtd') ) {
952 2         3 my $handler = $callbacks->{'LexicalHandler'};
953 2     0   10 $self->{Methods}->{'end_dtd'} = sub { $method->($handler, @_) };
  0         0  
954 2         11 return $method->($handler, @_);
955             }
956             elsif (defined $callbacks->{'Handler'} and $method = $callbacks->{'Handler'}->can('end_dtd') ) {
957 3         10 my $handler = $callbacks->{'Handler'};
958 3     0   8 $self->{Methods}->{'end_dtd'} = sub { $method->($handler, @_) };
  0         0  
959 3         10 return $method->($handler, @_);
960             }
961             elsif (defined $callbacks->{'LexicalHandler'}
962             and $callbacks->{'LexicalHandler'}->can('AUTOLOAD')
963             and $callbacks->{'LexicalHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
964             )
965             {
966 1         1 my $res = eval { $callbacks->{'LexicalHandler'}->end_dtd(@_) };
  1         5  
967 1 50       31 if ($@) {
968 0         0 die $@;
969             }
970             else {
971             # I think there's a buggette here...
972             # if the first call throws an exception, we don't set it up right.
973             # Not fatal, but we might want to address it.
974 1         1 my $handler = $callbacks->{'LexicalHandler'};
975 1     0   4 $self->{Methods}->{'end_dtd'} = sub { $handler->end_dtd(@_) };
  0         0  
976             }
977 1         2 return $res;
978             }
979             elsif (defined $callbacks->{'Handler'}
980             and $callbacks->{'Handler'}->can('AUTOLOAD')
981             and $callbacks->{'Handler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
982             )
983             {
984 1         10 my $res = eval { $callbacks->{'Handler'}->end_dtd(@_) };
  1         8  
985 1 50       64 if ($@) {
986 0         0 die $@;
987             }
988             else {
989             # I think there's a buggette here...
990             # if the first call throws an exception, we don't set it up right.
991             # Not fatal, but we might want to address it.
992 1         3 my $handler = $callbacks->{'Handler'};
993 1     0   5 $self->{Methods}->{'end_dtd'} = sub { $handler->end_dtd(@_) };
  0         0  
994             }
995 1         4 return $res;
996             }
997             else {
998 0     0   0 $self->{Methods}->{'end_dtd'} = sub { };
999             }
1000             }
1001              
1002             }
1003              
1004             sub element_decl {
1005 7     7 1 50 my $self = shift;
1006 7 50       22 if (defined $self->{Methods}->{'element_decl'}) {
1007 0         0 $self->{Methods}->{'element_decl'}->(@_);
1008             }
1009             else {
1010 7         7 my $method;
1011             my $callbacks;
1012 7 50       22 if (exists $self->{ParseOptions}) {
1013 0         0 $callbacks = $self->{ParseOptions};
1014             }
1015             else {
1016 7         9 $callbacks = $self;
1017             }
1018 7 100 100     169 if (0) { # dummy to make elsif's below compile
    100 66        
    100 50        
    50 66        
      33        
      50        
      33        
1019             }
1020 0 100       0 elsif (defined $callbacks->{'DeclHandler'} and $method = $callbacks->{'DeclHandler'}->can('element_decl') ) {
1021 2         3 my $handler = $callbacks->{'DeclHandler'};
1022 2     0   9 $self->{Methods}->{'element_decl'} = sub { $method->($handler, @_) };
  0         0  
1023 2         15 return $method->($handler, @_);
1024             }
1025             elsif (defined $callbacks->{'Handler'} and $method = $callbacks->{'Handler'}->can('element_decl') ) {
1026 3         5 my $handler = $callbacks->{'Handler'};
1027 3     0   10 $self->{Methods}->{'element_decl'} = sub { $method->($handler, @_) };
  0         0  
1028 3         13 return $method->($handler, @_);
1029             }
1030             elsif (defined $callbacks->{'DeclHandler'}
1031             and $callbacks->{'DeclHandler'}->can('AUTOLOAD')
1032             and $callbacks->{'DeclHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
1033             )
1034             {
1035 1         2 my $res = eval { $callbacks->{'DeclHandler'}->element_decl(@_) };
  1         5  
1036 1 50       91 if ($@) {
1037 0         0 die $@;
1038             }
1039             else {
1040             # I think there's a buggette here...
1041             # if the first call throws an exception, we don't set it up right.
1042             # Not fatal, but we might want to address it.
1043 1         11 my $handler = $callbacks->{'DeclHandler'};
1044 1     0   5 $self->{Methods}->{'element_decl'} = sub { $handler->element_decl(@_) };
  0         0  
1045             }
1046 1         2 return $res;
1047             }
1048             elsif (defined $callbacks->{'Handler'}
1049             and $callbacks->{'Handler'}->can('AUTOLOAD')
1050             and $callbacks->{'Handler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
1051             )
1052             {
1053 1         3 my $res = eval { $callbacks->{'Handler'}->element_decl(@_) };
  1         8  
1054 1 50       66 if ($@) {
1055 0         0 die $@;
1056             }
1057             else {
1058             # I think there's a buggette here...
1059             # if the first call throws an exception, we don't set it up right.
1060             # Not fatal, but we might want to address it.
1061 1         2 my $handler = $callbacks->{'Handler'};
1062 1     0   15 $self->{Methods}->{'element_decl'} = sub { $handler->element_decl(@_) };
  0         0  
1063             }
1064 1         4 return $res;
1065             }
1066             else {
1067 0     0   0 $self->{Methods}->{'element_decl'} = sub { };
1068             }
1069             }
1070              
1071             }
1072              
1073             sub start_element {
1074 36     36 1 211 my $self = shift;
1075 36 100       82 if (defined $self->{Methods}->{'start_element'}) {
1076 17         21 $self->{Methods}->{'start_element'}->(@_);
1077             }
1078             else {
1079 19         20 my $method;
1080             my $callbacks;
1081 19 100       57 if (exists $self->{ParseOptions}) {
1082 4         6 $callbacks = $self->{ParseOptions};
1083             }
1084             else {
1085 15         28 $callbacks = $self;
1086             }
1087 19 100 100     330 if (0) { # dummy to make elsif's below compile
    100 100        
    100 66        
    100 50        
    100 66        
    50 66        
      50        
      66        
      33        
      50        
      33        
1088             }
1089 0 100       0 elsif (defined $callbacks->{'ContentHandler'} and $method = $callbacks->{'ContentHandler'}->can('start_element') ) {
1090 5         8 my $handler = $callbacks->{'ContentHandler'};
1091 5     6   21 $self->{Methods}->{'start_element'} = sub { $method->($handler, @_) };
  6         14  
1092 5         25 return $method->($handler, @_);
1093             }
1094             elsif (defined $callbacks->{'DocumentHandler'} and $method = $callbacks->{'DocumentHandler'}->can('start_element') ) {
1095 6         7 my $handler = $callbacks->{'DocumentHandler'};
1096 6     11   28 $self->{Methods}->{'start_element'} = sub { $method->($handler, @_) };
  11         34  
1097 6         29 return $method->($handler, @_);
1098             }
1099             elsif (defined $callbacks->{'Handler'} and $method = $callbacks->{'Handler'}->can('start_element') ) {
1100 3         3 my $handler = $callbacks->{'Handler'};
1101 3     0   8 $self->{Methods}->{'start_element'} = sub { $method->($handler, @_) };
  0         0  
1102 3         13 return $method->($handler, @_);
1103             }
1104             elsif (defined $callbacks->{'ContentHandler'}
1105             and $callbacks->{'ContentHandler'}->can('AUTOLOAD')
1106             and $callbacks->{'ContentHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
1107             )
1108             {
1109 2         2 my $res = eval { $callbacks->{'ContentHandler'}->start_element(@_) };
  2         8  
1110 2 50       15 if ($@) {
1111 0         0 die $@;
1112             }
1113             else {
1114             # I think there's a buggette here...
1115             # if the first call throws an exception, we don't set it up right.
1116             # Not fatal, but we might want to address it.
1117 2         3 my $handler = $callbacks->{'ContentHandler'};
1118 2     0   6 $self->{Methods}->{'start_element'} = sub { $handler->start_element(@_) };
  0         0  
1119             }
1120 2         7 return $res;
1121             }
1122             elsif (defined $callbacks->{'DocumentHandler'}
1123             and $callbacks->{'DocumentHandler'}->can('AUTOLOAD')
1124             and $callbacks->{'DocumentHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
1125             )
1126             {
1127 1         2 my $res = eval { $callbacks->{'DocumentHandler'}->start_element(@_) };
  1         5  
1128 1 50       146 if ($@) {
1129 0         0 die $@;
1130             }
1131             else {
1132             # I think there's a buggette here...
1133             # if the first call throws an exception, we don't set it up right.
1134             # Not fatal, but we might want to address it.
1135 1         1 my $handler = $callbacks->{'DocumentHandler'};
1136 1     0   5 $self->{Methods}->{'start_element'} = sub { $handler->start_element(@_) };
  0         0  
1137             }
1138 1         3 return $res;
1139             }
1140             elsif (defined $callbacks->{'Handler'}
1141             and $callbacks->{'Handler'}->can('AUTOLOAD')
1142             and $callbacks->{'Handler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
1143             )
1144             {
1145 2         4 my $res = eval { $callbacks->{'Handler'}->start_element(@_) };
  2         12  
1146 2 50       213 if ($@) {
1147 0         0 die $@;
1148             }
1149             else {
1150             # I think there's a buggette here...
1151             # if the first call throws an exception, we don't set it up right.
1152             # Not fatal, but we might want to address it.
1153 2         5 my $handler = $callbacks->{'Handler'};
1154 2     0   10 $self->{Methods}->{'start_element'} = sub { $handler->start_element(@_) };
  0         0  
1155             }
1156 2         7 return $res;
1157             }
1158             else {
1159 0     0   0 $self->{Methods}->{'start_element'} = sub { };
1160             }
1161             }
1162              
1163             }
1164              
1165             sub error {
1166 7     7 1 30 my $self = shift;
1167 7 50       26 if (defined $self->{Methods}->{'error'}) {
1168 0         0 $self->{Methods}->{'error'}->(@_);
1169             }
1170             else {
1171 7         7 my $method;
1172             my $callbacks;
1173 7 50       16 if (exists $self->{ParseOptions}) {
1174 0         0 $callbacks = $self->{ParseOptions};
1175             }
1176             else {
1177 7         8 $callbacks = $self;
1178             }
1179 7 100 100     125 if (0) { # dummy to make elsif's below compile
    100 66        
    100 50        
    50 66        
      33        
      50        
      33        
1180             }
1181 0 100       0 elsif (defined $callbacks->{'ErrorHandler'} and $method = $callbacks->{'ErrorHandler'}->can('error') ) {
1182 2         3 my $handler = $callbacks->{'ErrorHandler'};
1183 2     0   9 $self->{Methods}->{'error'} = sub { $method->($handler, @_) };
  0         0  
1184 2         11 return $method->($handler, @_);
1185             }
1186             elsif (defined $callbacks->{'Handler'} and $method = $callbacks->{'Handler'}->can('error') ) {
1187 3         4 my $handler = $callbacks->{'Handler'};
1188 3     0   13 $self->{Methods}->{'error'} = sub { $method->($handler, @_) };
  0         0  
1189 3         9 return $method->($handler, @_);
1190             }
1191             elsif (defined $callbacks->{'ErrorHandler'}
1192             and $callbacks->{'ErrorHandler'}->can('AUTOLOAD')
1193             and $callbacks->{'ErrorHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
1194             )
1195             {
1196 1         1 my $res = eval { $callbacks->{'ErrorHandler'}->error(@_) };
  1         5  
1197 1 50       38 if ($@) {
1198 0         0 die $@;
1199             }
1200             else {
1201             # I think there's a buggette here...
1202             # if the first call throws an exception, we don't set it up right.
1203             # Not fatal, but we might want to address it.
1204 1         2 my $handler = $callbacks->{'ErrorHandler'};
1205 1     0   3 $self->{Methods}->{'error'} = sub { $handler->error(@_) };
  0         0  
1206             }
1207 1         2 return $res;
1208             }
1209             elsif (defined $callbacks->{'Handler'}
1210             and $callbacks->{'Handler'}->can('AUTOLOAD')
1211             and $callbacks->{'Handler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
1212             )
1213             {
1214 1         2 my $res = eval { $callbacks->{'Handler'}->error(@_) };
  1         7  
1215 1 50       71 if ($@) {
1216 0         0 die $@;
1217             }
1218             else {
1219             # I think there's a buggette here...
1220             # if the first call throws an exception, we don't set it up right.
1221             # Not fatal, but we might want to address it.
1222 1         2 my $handler = $callbacks->{'Handler'};
1223 1     0   7 $self->{Methods}->{'error'} = sub { $handler->error(@_) };
  0         0  
1224             }
1225 1         3 return $res;
1226             }
1227             else {
1228 0     0   0 $self->{Methods}->{'error'} = sub { };
1229             }
1230             }
1231              
1232             }
1233              
1234             sub xml_decl {
1235 9     9 1 39 my $self = shift;
1236 9 50       22 if (defined $self->{Methods}->{'xml_decl'}) {
1237 0         0 $self->{Methods}->{'xml_decl'}->(@_);
1238             }
1239             else {
1240 9         7 my $method;
1241             my $callbacks;
1242 9 50       18 if (exists $self->{ParseOptions}) {
1243 0         0 $callbacks = $self->{ParseOptions};
1244             }
1245             else {
1246 9         11 $callbacks = $self;
1247             }
1248 9 100 100     172 if (0) { # dummy to make elsif's below compile
    100 66        
    100 50        
    50 66        
      33        
      50        
      33        
1249             }
1250 0 100       0 elsif (defined $callbacks->{'DTDHandler'} and $method = $callbacks->{'DTDHandler'}->can('xml_decl') ) {
1251 3         6 my $handler = $callbacks->{'DTDHandler'};
1252 3     0   16 $self->{Methods}->{'xml_decl'} = sub { $method->($handler, @_) };
  0         0  
1253 3         19 return $method->($handler, @_);
1254             }
1255             elsif (defined $callbacks->{'Handler'} and $method = $callbacks->{'Handler'}->can('xml_decl') ) {
1256 3         3 my $handler = $callbacks->{'Handler'};
1257 3     0   10 $self->{Methods}->{'xml_decl'} = sub { $method->($handler, @_) };
  0         0  
1258 3         11 return $method->($handler, @_);
1259             }
1260             elsif (defined $callbacks->{'DTDHandler'}
1261             and $callbacks->{'DTDHandler'}->can('AUTOLOAD')
1262             and $callbacks->{'DTDHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
1263             )
1264             {
1265 1         1 my $res = eval { $callbacks->{'DTDHandler'}->xml_decl(@_) };
  1         8  
1266 1 50       35 if ($@) {
1267 0         0 die $@;
1268             }
1269             else {
1270             # I think there's a buggette here...
1271             # if the first call throws an exception, we don't set it up right.
1272             # Not fatal, but we might want to address it.
1273 1         1 my $handler = $callbacks->{'DTDHandler'};
1274 1     0   3 $self->{Methods}->{'xml_decl'} = sub { $handler->xml_decl(@_) };
  0         0  
1275             }
1276 1         2 return $res;
1277             }
1278             elsif (defined $callbacks->{'Handler'}
1279             and $callbacks->{'Handler'}->can('AUTOLOAD')
1280             and $callbacks->{'Handler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
1281             )
1282             {
1283 2         4 my $res = eval { $callbacks->{'Handler'}->xml_decl(@_) };
  2         12  
1284 2 50       203 if ($@) {
1285 0         0 die $@;
1286             }
1287             else {
1288             # I think there's a buggette here...
1289             # if the first call throws an exception, we don't set it up right.
1290             # Not fatal, but we might want to address it.
1291 2         6 my $handler = $callbacks->{'Handler'};
1292 2     0   10 $self->{Methods}->{'xml_decl'} = sub { $handler->xml_decl(@_) };
  0         0  
1293             }
1294 2         5 return $res;
1295             }
1296             else {
1297 0     0   0 $self->{Methods}->{'xml_decl'} = sub { };
1298             }
1299             }
1300              
1301             }
1302              
1303             sub end_document {
1304 12     12 1 57 my $self = shift;
1305 12 50       34 if (defined $self->{Methods}->{'end_document'}) {
1306 0         0 $self->{Methods}->{'end_document'}->(@_);
1307             }
1308             else {
1309 12         16 my $method;
1310             my $callbacks;
1311 12 50       19 if (exists $self->{ParseOptions}) {
1312 0         0 $callbacks = $self->{ParseOptions};
1313             }
1314             else {
1315 12         15 $callbacks = $self;
1316             }
1317 12 100 100     218 if (0) { # dummy to make elsif's below compile
    100 100        
    100 33        
    50 0        
    100 33        
    50 66        
      50        
      66        
      33        
      50        
      33        
1318             }
1319 0 100       0 elsif (defined $callbacks->{'ContentHandler'} and $method = $callbacks->{'ContentHandler'}->can('end_document') ) {
1320 4         5 my $handler = $callbacks->{'ContentHandler'};
1321 4     0   19 $self->{Methods}->{'end_document'} = sub { $method->($handler, @_) };
  0         0  
1322 4         21 return $method->($handler, @_);
1323             }
1324             elsif (defined $callbacks->{'DocumentHandler'} and $method = $callbacks->{'DocumentHandler'}->can('end_document') ) {
1325 2         3 my $handler = $callbacks->{'DocumentHandler'};
1326 2     0   6 $self->{Methods}->{'end_document'} = sub { $method->($handler, @_) };
  0         0  
1327 2         13 return $method->($handler, @_);
1328             }
1329             elsif (defined $callbacks->{'Handler'} and $method = $callbacks->{'Handler'}->can('end_document') ) {
1330 3         6 my $handler = $callbacks->{'Handler'};
1331 3     0   11 $self->{Methods}->{'end_document'} = sub { $method->($handler, @_) };
  0         0  
1332 3         12 return $method->($handler, @_);
1333             }
1334             elsif (defined $callbacks->{'ContentHandler'}
1335             and $callbacks->{'ContentHandler'}->can('AUTOLOAD')
1336             and $callbacks->{'ContentHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
1337             )
1338             {
1339 0         0 my $res = eval { $callbacks->{'ContentHandler'}->end_document(@_) };
  0         0  
1340 0 0       0 if ($@) {
1341 0         0 die $@;
1342             }
1343             else {
1344             # I think there's a buggette here...
1345             # if the first call throws an exception, we don't set it up right.
1346             # Not fatal, but we might want to address it.
1347 0         0 my $handler = $callbacks->{'ContentHandler'};
1348 0     0   0 $self->{Methods}->{'end_document'} = sub { $handler->end_document(@_) };
  0         0  
1349             }
1350 0         0 return $res;
1351             }
1352             elsif (defined $callbacks->{'DocumentHandler'}
1353             and $callbacks->{'DocumentHandler'}->can('AUTOLOAD')
1354             and $callbacks->{'DocumentHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
1355             )
1356             {
1357 1         1 my $res = eval { $callbacks->{'DocumentHandler'}->end_document(@_) };
  1         6  
1358 1 50       135 if ($@) {
1359 0         0 die $@;
1360             }
1361             else {
1362             # I think there's a buggette here...
1363             # if the first call throws an exception, we don't set it up right.
1364             # Not fatal, but we might want to address it.
1365 1         2 my $handler = $callbacks->{'DocumentHandler'};
1366 1     0   8 $self->{Methods}->{'end_document'} = sub { $handler->end_document(@_) };
  0         0  
1367             }
1368 1         6 return $res;
1369             }
1370             elsif (defined $callbacks->{'Handler'}
1371             and $callbacks->{'Handler'}->can('AUTOLOAD')
1372             and $callbacks->{'Handler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
1373             )
1374             {
1375 2         5 my $res = eval { $callbacks->{'Handler'}->end_document(@_) };
  2         11  
1376 2 50       200 if ($@) {
1377 0         0 die $@;
1378             }
1379             else {
1380             # I think there's a buggette here...
1381             # if the first call throws an exception, we don't set it up right.
1382             # Not fatal, but we might want to address it.
1383 2         5 my $handler = $callbacks->{'Handler'};
1384 2     0   16 $self->{Methods}->{'end_document'} = sub { $handler->end_document(@_) };
  0         0  
1385             }
1386 2         6 return $res;
1387             }
1388             else {
1389 0     0   0 $self->{Methods}->{'end_document'} = sub { };
1390             }
1391             }
1392              
1393             }
1394              
1395             sub attribute_decl {
1396 7     7 1 34 my $self = shift;
1397 7 50       20 if (defined $self->{Methods}->{'attribute_decl'}) {
1398 0         0 $self->{Methods}->{'attribute_decl'}->(@_);
1399             }
1400             else {
1401 7         7 my $method;
1402             my $callbacks;
1403 7 50       23 if (exists $self->{ParseOptions}) {
1404 0         0 $callbacks = $self->{ParseOptions};
1405             }
1406             else {
1407 7         12 $callbacks = $self;
1408             }
1409 7 100 100     118 if (0) { # dummy to make elsif's below compile
    100 66        
    100 50        
    50 66        
      33        
      50        
      33        
1410             }
1411 0 100       0 elsif (defined $callbacks->{'DeclHandler'} and $method = $callbacks->{'DeclHandler'}->can('attribute_decl') ) {
1412 2         3 my $handler = $callbacks->{'DeclHandler'};
1413 2     0   9 $self->{Methods}->{'attribute_decl'} = sub { $method->($handler, @_) };
  0         0  
1414 2         16 return $method->($handler, @_);
1415             }
1416             elsif (defined $callbacks->{'Handler'} and $method = $callbacks->{'Handler'}->can('attribute_decl') ) {
1417 3         4 my $handler = $callbacks->{'Handler'};
1418 3     0   10 $self->{Methods}->{'attribute_decl'} = sub { $method->($handler, @_) };
  0         0  
1419 3         9 return $method->($handler, @_);
1420             }
1421             elsif (defined $callbacks->{'DeclHandler'}
1422             and $callbacks->{'DeclHandler'}->can('AUTOLOAD')
1423             and $callbacks->{'DeclHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
1424             )
1425             {
1426 1         1 my $res = eval { $callbacks->{'DeclHandler'}->attribute_decl(@_) };
  1         5  
1427 1 50       40 if ($@) {
1428 0         0 die $@;
1429             }
1430             else {
1431             # I think there's a buggette here...
1432             # if the first call throws an exception, we don't set it up right.
1433             # Not fatal, but we might want to address it.
1434 1         2 my $handler = $callbacks->{'DeclHandler'};
1435 1     0   3 $self->{Methods}->{'attribute_decl'} = sub { $handler->attribute_decl(@_) };
  0         0  
1436             }
1437 1         3 return $res;
1438             }
1439             elsif (defined $callbacks->{'Handler'}
1440             and $callbacks->{'Handler'}->can('AUTOLOAD')
1441             and $callbacks->{'Handler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
1442             )
1443             {
1444 1         2 my $res = eval { $callbacks->{'Handler'}->attribute_decl(@_) };
  1         12  
1445 1 50       70 if ($@) {
1446 0         0 die $@;
1447             }
1448             else {
1449             # I think there's a buggette here...
1450             # if the first call throws an exception, we don't set it up right.
1451             # Not fatal, but we might want to address it.
1452 1         2 my $handler = $callbacks->{'Handler'};
1453 1     0   5 $self->{Methods}->{'attribute_decl'} = sub { $handler->attribute_decl(@_) };
  0         0  
1454             }
1455 1         4 return $res;
1456             }
1457             else {
1458 0     0   0 $self->{Methods}->{'attribute_decl'} = sub { };
1459             }
1460             }
1461              
1462             }
1463              
1464             sub internal_entity_decl {
1465 7     7 1 30 my $self = shift;
1466 7 50       19 if (defined $self->{Methods}->{'internal_entity_decl'}) {
1467 0         0 $self->{Methods}->{'internal_entity_decl'}->(@_);
1468             }
1469             else {
1470 7         8 my $method;
1471             my $callbacks;
1472 7 50       14 if (exists $self->{ParseOptions}) {
1473 0         0 $callbacks = $self->{ParseOptions};
1474             }
1475             else {
1476 7         10 $callbacks = $self;
1477             }
1478 7 100 100     111 if (0) { # dummy to make elsif's below compile
    100 66        
    100 50        
    50 66        
      33        
      50        
      33        
1479             }
1480 0 100       0 elsif (defined $callbacks->{'DeclHandler'} and $method = $callbacks->{'DeclHandler'}->can('internal_entity_decl') ) {
1481 2         60 my $handler = $callbacks->{'DeclHandler'};
1482 2     0   11 $self->{Methods}->{'internal_entity_decl'} = sub { $method->($handler, @_) };
  0         0  
1483 2         15 return $method->($handler, @_);
1484             }
1485             elsif (defined $callbacks->{'Handler'} and $method = $callbacks->{'Handler'}->can('internal_entity_decl') ) {
1486 3         3 my $handler = $callbacks->{'Handler'};
1487 3     0   9 $self->{Methods}->{'internal_entity_decl'} = sub { $method->($handler, @_) };
  0         0  
1488 3         11 return $method->($handler, @_);
1489             }
1490             elsif (defined $callbacks->{'DeclHandler'}
1491             and $callbacks->{'DeclHandler'}->can('AUTOLOAD')
1492             and $callbacks->{'DeclHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
1493             )
1494             {
1495 1         2 my $res = eval { $callbacks->{'DeclHandler'}->internal_entity_decl(@_) };
  1         5  
1496 1 50       36 if ($@) {
1497 0         0 die $@;
1498             }
1499             else {
1500             # I think there's a buggette here...
1501             # if the first call throws an exception, we don't set it up right.
1502             # Not fatal, but we might want to address it.
1503 1         1 my $handler = $callbacks->{'DeclHandler'};
1504 1     0   4 $self->{Methods}->{'internal_entity_decl'} = sub { $handler->internal_entity_decl(@_) };
  0         0  
1505             }
1506 1         1 return $res;
1507             }
1508             elsif (defined $callbacks->{'Handler'}
1509             and $callbacks->{'Handler'}->can('AUTOLOAD')
1510             and $callbacks->{'Handler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
1511             )
1512             {
1513 1         2 my $res = eval { $callbacks->{'Handler'}->internal_entity_decl(@_) };
  1         7  
1514 1 50       71 if ($@) {
1515 0         0 die $@;
1516             }
1517             else {
1518             # I think there's a buggette here...
1519             # if the first call throws an exception, we don't set it up right.
1520             # Not fatal, but we might want to address it.
1521 1         3 my $handler = $callbacks->{'Handler'};
1522 1     0   6 $self->{Methods}->{'internal_entity_decl'} = sub { $handler->internal_entity_decl(@_) };
  0         0  
1523             }
1524 1         4 return $res;
1525             }
1526             else {
1527 0     0   0 $self->{Methods}->{'internal_entity_decl'} = sub { };
1528             }
1529             }
1530              
1531             }
1532              
1533             sub doctype_decl {
1534 9     9 1 40 my $self = shift;
1535 9 50       23 if (defined $self->{Methods}->{'doctype_decl'}) {
1536 0         0 $self->{Methods}->{'doctype_decl'}->(@_);
1537             }
1538             else {
1539 9         8 my $method;
1540             my $callbacks;
1541 9 50       17 if (exists $self->{ParseOptions}) {
1542 0         0 $callbacks = $self->{ParseOptions};
1543             }
1544             else {
1545 9         12 $callbacks = $self;
1546             }
1547 9 100 100     167 if (0) { # dummy to make elsif's below compile
    100 66        
    100 50        
    50 66        
      33        
      50        
      33        
1548             }
1549 0 100       0 elsif (defined $callbacks->{'DTDHandler'} and $method = $callbacks->{'DTDHandler'}->can('doctype_decl') ) {
1550 3         6 my $handler = $callbacks->{'DTDHandler'};
1551 3     0   14 $self->{Methods}->{'doctype_decl'} = sub { $method->($handler, @_) };
  0         0  
1552 3         29 return $method->($handler, @_);
1553             }
1554             elsif (defined $callbacks->{'Handler'} and $method = $callbacks->{'Handler'}->can('doctype_decl') ) {
1555 3         4 my $handler = $callbacks->{'Handler'};
1556 3     0   18 $self->{Methods}->{'doctype_decl'} = sub { $method->($handler, @_) };
  0         0  
1557 3         12 return $method->($handler, @_);
1558             }
1559             elsif (defined $callbacks->{'DTDHandler'}
1560             and $callbacks->{'DTDHandler'}->can('AUTOLOAD')
1561             and $callbacks->{'DTDHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
1562             )
1563             {
1564 1         2 my $res = eval { $callbacks->{'DTDHandler'}->doctype_decl(@_) };
  1         4  
1565 1 50       31 if ($@) {
1566 0         0 die $@;
1567             }
1568             else {
1569             # I think there's a buggette here...
1570             # if the first call throws an exception, we don't set it up right.
1571             # Not fatal, but we might want to address it.
1572 1         2 my $handler = $callbacks->{'DTDHandler'};
1573 1     0   3 $self->{Methods}->{'doctype_decl'} = sub { $handler->doctype_decl(@_) };
  0         0  
1574             }
1575 1         2 return $res;
1576             }
1577             elsif (defined $callbacks->{'Handler'}
1578             and $callbacks->{'Handler'}->can('AUTOLOAD')
1579             and $callbacks->{'Handler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
1580             )
1581             {
1582 2         3 my $res = eval { $callbacks->{'Handler'}->doctype_decl(@_) };
  2         12  
1583 2 50       196 if ($@) {
1584 0         0 die $@;
1585             }
1586             else {
1587             # I think there's a buggette here...
1588             # if the first call throws an exception, we don't set it up right.
1589             # Not fatal, but we might want to address it.
1590 2         13 my $handler = $callbacks->{'Handler'};
1591 2     0   10 $self->{Methods}->{'doctype_decl'} = sub { $handler->doctype_decl(@_) };
  0         0  
1592             }
1593 2         6 return $res;
1594             }
1595             else {
1596 0     0   0 $self->{Methods}->{'doctype_decl'} = sub { };
1597             }
1598             }
1599              
1600             }
1601              
1602             sub unparsed_entity_decl {
1603 9     9 1 40 my $self = shift;
1604 9 50       22 if (defined $self->{Methods}->{'unparsed_entity_decl'}) {
1605 0         0 $self->{Methods}->{'unparsed_entity_decl'}->(@_);
1606             }
1607             else {
1608 9         9 my $method;
1609             my $callbacks;
1610 9 50       26 if (exists $self->{ParseOptions}) {
1611 0         0 $callbacks = $self->{ParseOptions};
1612             }
1613             else {
1614 9         10 $callbacks = $self;
1615             }
1616 9 100 100     163 if (0) { # dummy to make elsif's below compile
    100 66        
    100 50        
    50 66        
      33        
      50        
      33        
1617             }
1618 0 100       0 elsif (defined $callbacks->{'DTDHandler'} and $method = $callbacks->{'DTDHandler'}->can('unparsed_entity_decl') ) {
1619 3         5 my $handler = $callbacks->{'DTDHandler'};
1620 3     0   11 $self->{Methods}->{'unparsed_entity_decl'} = sub { $method->($handler, @_) };
  0         0  
1621 3         23 return $method->($handler, @_);
1622             }
1623             elsif (defined $callbacks->{'Handler'} and $method = $callbacks->{'Handler'}->can('unparsed_entity_decl') ) {
1624 3         2 my $handler = $callbacks->{'Handler'};
1625 3     0   9 $self->{Methods}->{'unparsed_entity_decl'} = sub { $method->($handler, @_) };
  0         0  
1626 3         8 return $method->($handler, @_);
1627             }
1628             elsif (defined $callbacks->{'DTDHandler'}
1629             and $callbacks->{'DTDHandler'}->can('AUTOLOAD')
1630             and $callbacks->{'DTDHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
1631             )
1632             {
1633 1         2 my $res = eval { $callbacks->{'DTDHandler'}->unparsed_entity_decl(@_) };
  1         5  
1634 1 50       40 if ($@) {
1635 0         0 die $@;
1636             }
1637             else {
1638             # I think there's a buggette here...
1639             # if the first call throws an exception, we don't set it up right.
1640             # Not fatal, but we might want to address it.
1641 1         2 my $handler = $callbacks->{'DTDHandler'};
1642 1     0   4 $self->{Methods}->{'unparsed_entity_decl'} = sub { $handler->unparsed_entity_decl(@_) };
  0         0  
1643             }
1644 1         3 return $res;
1645             }
1646             elsif (defined $callbacks->{'Handler'}
1647             and $callbacks->{'Handler'}->can('AUTOLOAD')
1648             and $callbacks->{'Handler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
1649             )
1650             {
1651 2         4 my $res = eval { $callbacks->{'Handler'}->unparsed_entity_decl(@_) };
  2         11  
1652 2 50       220 if ($@) {
1653 0         0 die $@;
1654             }
1655             else {
1656             # I think there's a buggette here...
1657             # if the first call throws an exception, we don't set it up right.
1658             # Not fatal, but we might want to address it.
1659 2         8 my $handler = $callbacks->{'Handler'};
1660 2     0   9 $self->{Methods}->{'unparsed_entity_decl'} = sub { $handler->unparsed_entity_decl(@_) };
  0         0  
1661             }
1662 2         6 return $res;
1663             }
1664             else {
1665 0     0   0 $self->{Methods}->{'unparsed_entity_decl'} = sub { };
1666             }
1667             }
1668              
1669             }
1670              
1671             sub skipped_entity {
1672 8     8 1 47 my $self = shift;
1673 8 50       31 if (defined $self->{Methods}->{'skipped_entity'}) {
1674 0         0 $self->{Methods}->{'skipped_entity'}->(@_);
1675             }
1676             else {
1677 8         8 my $method;
1678             my $callbacks;
1679 8 50       15 if (exists $self->{ParseOptions}) {
1680 0         0 $callbacks = $self->{ParseOptions};
1681             }
1682             else {
1683 8         11 $callbacks = $self;
1684             }
1685 8 100 100     146 if (0) { # dummy to make elsif's below compile
    100 66        
    100 50        
    50 66        
      33        
      50        
      33        
1686             }
1687 0 100       0 elsif (defined $callbacks->{'ContentHandler'} and $method = $callbacks->{'ContentHandler'}->can('skipped_entity') ) {
1688 2         4 my $handler = $callbacks->{'ContentHandler'};
1689 2     0   10 $self->{Methods}->{'skipped_entity'} = sub { $method->($handler, @_) };
  0         0  
1690 2         13 return $method->($handler, @_);
1691             }
1692             elsif (defined $callbacks->{'Handler'} and $method = $callbacks->{'Handler'}->can('skipped_entity') ) {
1693 3         3 my $handler = $callbacks->{'Handler'};
1694 3     0   8 $self->{Methods}->{'skipped_entity'} = sub { $method->($handler, @_) };
  0         0  
1695 3         14 return $method->($handler, @_);
1696             }
1697             elsif (defined $callbacks->{'ContentHandler'}
1698             and $callbacks->{'ContentHandler'}->can('AUTOLOAD')
1699             and $callbacks->{'ContentHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
1700             )
1701             {
1702 2         2 my $res = eval { $callbacks->{'ContentHandler'}->skipped_entity(@_) };
  2         12  
1703 2 50       17 if ($@) {
1704 0         0 die $@;
1705             }
1706             else {
1707             # I think there's a buggette here...
1708             # if the first call throws an exception, we don't set it up right.
1709             # Not fatal, but we might want to address it.
1710 2         3 my $handler = $callbacks->{'ContentHandler'};
1711 2     0   10 $self->{Methods}->{'skipped_entity'} = sub { $handler->skipped_entity(@_) };
  0         0  
1712             }
1713 2         3 return $res;
1714             }
1715             elsif (defined $callbacks->{'Handler'}
1716             and $callbacks->{'Handler'}->can('AUTOLOAD')
1717             and $callbacks->{'Handler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
1718             )
1719             {
1720 1         2 my $res = eval { $callbacks->{'Handler'}->skipped_entity(@_) };
  1         8  
1721 1 50       77 if ($@) {
1722 0         0 die $@;
1723             }
1724             else {
1725             # I think there's a buggette here...
1726             # if the first call throws an exception, we don't set it up right.
1727             # Not fatal, but we might want to address it.
1728 1         2 my $handler = $callbacks->{'Handler'};
1729 1     0   7 $self->{Methods}->{'skipped_entity'} = sub { $handler->skipped_entity(@_) };
  0         0  
1730             }
1731 1         4 return $res;
1732             }
1733             else {
1734 0     0   0 $self->{Methods}->{'skipped_entity'} = sub { };
1735             }
1736             }
1737              
1738             }
1739              
1740             sub end_prefix_mapping {
1741 8     8 1 35 my $self = shift;
1742 8 50       33 if (defined $self->{Methods}->{'end_prefix_mapping'}) {
1743 0         0 $self->{Methods}->{'end_prefix_mapping'}->(@_);
1744             }
1745             else {
1746 8         10 my $method;
1747             my $callbacks;
1748 8 50       16 if (exists $self->{ParseOptions}) {
1749 0         0 $callbacks = $self->{ParseOptions};
1750             }
1751             else {
1752 8         9 $callbacks = $self;
1753             }
1754 8 100 100     184 if (0) { # dummy to make elsif's below compile
    100 66        
    100 50        
    50 66        
      33        
      50        
      33        
1755             }
1756 0 100       0 elsif (defined $callbacks->{'ContentHandler'} and $method = $callbacks->{'ContentHandler'}->can('end_prefix_mapping') ) {
1757 2         4 my $handler = $callbacks->{'ContentHandler'};
1758 2     0   10 $self->{Methods}->{'end_prefix_mapping'} = sub { $method->($handler, @_) };
  0         0  
1759 2         15 return $method->($handler, @_);
1760             }
1761             elsif (defined $callbacks->{'Handler'} and $method = $callbacks->{'Handler'}->can('end_prefix_mapping') ) {
1762 3         3 my $handler = $callbacks->{'Handler'};
1763 3     0   15 $self->{Methods}->{'end_prefix_mapping'} = sub { $method->($handler, @_) };
  0         0  
1764 3         10 return $method->($handler, @_);
1765             }
1766             elsif (defined $callbacks->{'ContentHandler'}
1767             and $callbacks->{'ContentHandler'}->can('AUTOLOAD')
1768             and $callbacks->{'ContentHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
1769             )
1770             {
1771 2         2 my $res = eval { $callbacks->{'ContentHandler'}->end_prefix_mapping(@_) };
  2         9  
1772 2 50       16 if ($@) {
1773 0         0 die $@;
1774             }
1775             else {
1776             # I think there's a buggette here...
1777             # if the first call throws an exception, we don't set it up right.
1778             # Not fatal, but we might want to address it.
1779 2         4 my $handler = $callbacks->{'ContentHandler'};
1780 2     0   7 $self->{Methods}->{'end_prefix_mapping'} = sub { $handler->end_prefix_mapping(@_) };
  0         0  
1781             }
1782 2         4 return $res;
1783             }
1784             elsif (defined $callbacks->{'Handler'}
1785             and $callbacks->{'Handler'}->can('AUTOLOAD')
1786             and $callbacks->{'Handler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
1787             )
1788             {
1789 1         2 my $res = eval { $callbacks->{'Handler'}->end_prefix_mapping(@_) };
  1         7  
1790 1 50       69 if ($@) {
1791 0         0 die $@;
1792             }
1793             else {
1794             # I think there's a buggette here...
1795             # if the first call throws an exception, we don't set it up right.
1796             # Not fatal, but we might want to address it.
1797 1         3 my $handler = $callbacks->{'Handler'};
1798 1     0   5 $self->{Methods}->{'end_prefix_mapping'} = sub { $handler->end_prefix_mapping(@_) };
  0         0  
1799             }
1800 1         12 return $res;
1801             }
1802             else {
1803 0     0   0 $self->{Methods}->{'end_prefix_mapping'} = sub { };
1804             }
1805             }
1806              
1807             }
1808              
1809             sub characters {
1810 12     12 1 59 my $self = shift;
1811 12 50       31 if (defined $self->{Methods}->{'characters'}) {
1812 0         0 $self->{Methods}->{'characters'}->(@_);
1813             }
1814             else {
1815 12         13 my $method;
1816             my $callbacks;
1817 12 50       22 if (exists $self->{ParseOptions}) {
1818 0         0 $callbacks = $self->{ParseOptions};
1819             }
1820             else {
1821 12         17 $callbacks = $self;
1822             }
1823 12 100 100     271 if (0) { # dummy to make elsif's below compile
    100 100        
    100 66        
    100 50        
    100 66        
    50 66        
      50        
      66        
      33        
      50        
      33        
1824             }
1825 0 100       0 elsif (defined $callbacks->{'ContentHandler'} and $method = $callbacks->{'ContentHandler'}->can('characters') ) {
1826 2         4 my $handler = $callbacks->{'ContentHandler'};
1827 2     0   15 $self->{Methods}->{'characters'} = sub { $method->($handler, @_) };
  0         0  
1828 2         17 return $method->($handler, @_);
1829             }
1830             elsif (defined $callbacks->{'DocumentHandler'} and $method = $callbacks->{'DocumentHandler'}->can('characters') ) {
1831 2         3 my $handler = $callbacks->{'DocumentHandler'};
1832 2     0   7 $self->{Methods}->{'characters'} = sub { $method->($handler, @_) };
  0         0  
1833 2         15 return $method->($handler, @_);
1834             }
1835             elsif (defined $callbacks->{'Handler'} and $method = $callbacks->{'Handler'}->can('characters') ) {
1836 3         4 my $handler = $callbacks->{'Handler'};
1837 3     0   11 $self->{Methods}->{'characters'} = sub { $method->($handler, @_) };
  0         0  
1838 3         11 return $method->($handler, @_);
1839             }
1840             elsif (defined $callbacks->{'ContentHandler'}
1841             and $callbacks->{'ContentHandler'}->can('AUTOLOAD')
1842             and $callbacks->{'ContentHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
1843             )
1844             {
1845 2         3 my $res = eval { $callbacks->{'ContentHandler'}->characters(@_) };
  2         8  
1846 2 50       20 if ($@) {
1847 0         0 die $@;
1848             }
1849             else {
1850             # I think there's a buggette here...
1851             # if the first call throws an exception, we don't set it up right.
1852             # Not fatal, but we might want to address it.
1853 2         2 my $handler = $callbacks->{'ContentHandler'};
1854 2     0   7 $self->{Methods}->{'characters'} = sub { $handler->characters(@_) };
  0         0  
1855             }
1856 2         4 return $res;
1857             }
1858             elsif (defined $callbacks->{'DocumentHandler'}
1859             and $callbacks->{'DocumentHandler'}->can('AUTOLOAD')
1860             and $callbacks->{'DocumentHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
1861             )
1862             {
1863 1         1 my $res = eval { $callbacks->{'DocumentHandler'}->characters(@_) };
  1         5  
1864 1 50       142 if ($@) {
1865 0         0 die $@;
1866             }
1867             else {
1868             # I think there's a buggette here...
1869             # if the first call throws an exception, we don't set it up right.
1870             # Not fatal, but we might want to address it.
1871 1         2 my $handler = $callbacks->{'DocumentHandler'};
1872 1     0   5 $self->{Methods}->{'characters'} = sub { $handler->characters(@_) };
  0         0  
1873             }
1874 1         2 return $res;
1875             }
1876             elsif (defined $callbacks->{'Handler'}
1877             and $callbacks->{'Handler'}->can('AUTOLOAD')
1878             and $callbacks->{'Handler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
1879             )
1880             {
1881 2         3 my $res = eval { $callbacks->{'Handler'}->characters(@_) };
  2         11  
1882 2 50       244 if ($@) {
1883 0         0 die $@;
1884             }
1885             else {
1886             # I think there's a buggette here...
1887             # if the first call throws an exception, we don't set it up right.
1888             # Not fatal, but we might want to address it.
1889 2         5 my $handler = $callbacks->{'Handler'};
1890 2     0   11 $self->{Methods}->{'characters'} = sub { $handler->characters(@_) };
  0         0  
1891             }
1892 2         11 return $res;
1893             }
1894             else {
1895 0     0   0 $self->{Methods}->{'characters'} = sub { };
1896             }
1897             }
1898              
1899             }
1900              
1901             sub comment {
1902 7     7 1 47 my $self = shift;
1903 7 50       18 if (defined $self->{Methods}->{'comment'}) {
1904 0         0 $self->{Methods}->{'comment'}->(@_);
1905             }
1906             else {
1907 7         14 my $method;
1908             my $callbacks;
1909 7 50       14 if (exists $self->{ParseOptions}) {
1910 0         0 $callbacks = $self->{ParseOptions};
1911             }
1912             else {
1913 7         9 $callbacks = $self;
1914             }
1915 7 50 100     145 if (0) { # dummy to make elsif's below compile
    100 100        
    100 33        
    50 0        
    100 33        
    50 66        
      50        
      66        
      33        
      50        
      33        
1916             }
1917 0 50       0 elsif (defined $callbacks->{'DocumentHandler'} and $method = $callbacks->{'DocumentHandler'}->can('comment') ) {
1918 0         0 my $handler = $callbacks->{'DocumentHandler'};
1919 0     0   0 $self->{Methods}->{'comment'} = sub { $method->($handler, @_) };
  0         0  
1920 0         0 return $method->($handler, @_);
1921             }
1922             elsif (defined $callbacks->{'LexicalHandler'} and $method = $callbacks->{'LexicalHandler'}->can('comment') ) {
1923 2         5 my $handler = $callbacks->{'LexicalHandler'};
1924 2     0   9 $self->{Methods}->{'comment'} = sub { $method->($handler, @_) };
  0         0  
1925 2         24 return $method->($handler, @_);
1926             }
1927             elsif (defined $callbacks->{'Handler'} and $method = $callbacks->{'Handler'}->can('comment') ) {
1928 3         3 my $handler = $callbacks->{'Handler'};
1929 3     0   12 $self->{Methods}->{'comment'} = sub { $method->($handler, @_) };
  0         0  
1930 3         13 return $method->($handler, @_);
1931             }
1932             elsif (defined $callbacks->{'DocumentHandler'}
1933             and $callbacks->{'DocumentHandler'}->can('AUTOLOAD')
1934             and $callbacks->{'DocumentHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
1935             )
1936             {
1937 0         0 my $res = eval { $callbacks->{'DocumentHandler'}->comment(@_) };
  0         0  
1938 0 0       0 if ($@) {
1939 0         0 die $@;
1940             }
1941             else {
1942             # I think there's a buggette here...
1943             # if the first call throws an exception, we don't set it up right.
1944             # Not fatal, but we might want to address it.
1945 0         0 my $handler = $callbacks->{'DocumentHandler'};
1946 0     0   0 $self->{Methods}->{'comment'} = sub { $handler->comment(@_) };
  0         0  
1947             }
1948 0         0 return $res;
1949             }
1950             elsif (defined $callbacks->{'LexicalHandler'}
1951             and $callbacks->{'LexicalHandler'}->can('AUTOLOAD')
1952             and $callbacks->{'LexicalHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
1953             )
1954             {
1955 1         2 my $res = eval { $callbacks->{'LexicalHandler'}->comment(@_) };
  1         5  
1956 1 50       86 if ($@) {
1957 0         0 die $@;
1958             }
1959             else {
1960             # I think there's a buggette here...
1961             # if the first call throws an exception, we don't set it up right.
1962             # Not fatal, but we might want to address it.
1963 1         13 my $handler = $callbacks->{'LexicalHandler'};
1964 1     0   5 $self->{Methods}->{'comment'} = sub { $handler->comment(@_) };
  0         0  
1965             }
1966 1         3 return $res;
1967             }
1968             elsif (defined $callbacks->{'Handler'}
1969             and $callbacks->{'Handler'}->can('AUTOLOAD')
1970             and $callbacks->{'Handler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
1971             )
1972             {
1973 1         2 my $res = eval { $callbacks->{'Handler'}->comment(@_) };
  1         7  
1974 1 50       65 if ($@) {
1975 0         0 die $@;
1976             }
1977             else {
1978             # I think there's a buggette here...
1979             # if the first call throws an exception, we don't set it up right.
1980             # Not fatal, but we might want to address it.
1981 1         3 my $handler = $callbacks->{'Handler'};
1982 1     0   5 $self->{Methods}->{'comment'} = sub { $handler->comment(@_) };
  0         0  
1983             }
1984 1         4 return $res;
1985             }
1986             else {
1987 0     0   0 $self->{Methods}->{'comment'} = sub { };
1988             }
1989             }
1990              
1991             }
1992              
1993             sub start_dtd {
1994 7     7 1 33 my $self = shift;
1995 7 50       23 if (defined $self->{Methods}->{'start_dtd'}) {
1996 0         0 $self->{Methods}->{'start_dtd'}->(@_);
1997             }
1998             else {
1999 7         12 my $method;
2000             my $callbacks;
2001 7 50       16 if (exists $self->{ParseOptions}) {
2002 0         0 $callbacks = $self->{ParseOptions};
2003             }
2004             else {
2005 7         10 $callbacks = $self;
2006             }
2007 7 100 100     114 if (0) { # dummy to make elsif's below compile
    100 66        
    100 50        
    50 66        
      33        
      50        
      33        
2008             }
2009 0 100       0 elsif (defined $callbacks->{'LexicalHandler'} and $method = $callbacks->{'LexicalHandler'}->can('start_dtd') ) {
2010 2         3 my $handler = $callbacks->{'LexicalHandler'};
2011 2     0   8 $self->{Methods}->{'start_dtd'} = sub { $method->($handler, @_) };
  0         0  
2012 2         14 return $method->($handler, @_);
2013             }
2014             elsif (defined $callbacks->{'Handler'} and $method = $callbacks->{'Handler'}->can('start_dtd') ) {
2015 3         6 my $handler = $callbacks->{'Handler'};
2016 3     0   9 $self->{Methods}->{'start_dtd'} = sub { $method->($handler, @_) };
  0         0  
2017 3         14 return $method->($handler, @_);
2018             }
2019             elsif (defined $callbacks->{'LexicalHandler'}
2020             and $callbacks->{'LexicalHandler'}->can('AUTOLOAD')
2021             and $callbacks->{'LexicalHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
2022             )
2023             {
2024 1         1 my $res = eval { $callbacks->{'LexicalHandler'}->start_dtd(@_) };
  1         5  
2025 1 50       38 if ($@) {
2026 0         0 die $@;
2027             }
2028             else {
2029             # I think there's a buggette here...
2030             # if the first call throws an exception, we don't set it up right.
2031             # Not fatal, but we might want to address it.
2032 1         2 my $handler = $callbacks->{'LexicalHandler'};
2033 1     0   4 $self->{Methods}->{'start_dtd'} = sub { $handler->start_dtd(@_) };
  0         0  
2034             }
2035 1         2 return $res;
2036             }
2037             elsif (defined $callbacks->{'Handler'}
2038             and $callbacks->{'Handler'}->can('AUTOLOAD')
2039             and $callbacks->{'Handler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
2040             )
2041             {
2042 1         2 my $res = eval { $callbacks->{'Handler'}->start_dtd(@_) };
  1         12  
2043 1 50       63 if ($@) {
2044 0         0 die $@;
2045             }
2046             else {
2047             # I think there's a buggette here...
2048             # if the first call throws an exception, we don't set it up right.
2049             # Not fatal, but we might want to address it.
2050 1         2 my $handler = $callbacks->{'Handler'};
2051 1     0   11 $self->{Methods}->{'start_dtd'} = sub { $handler->start_dtd(@_) };
  0         0  
2052             }
2053 1         3 return $res;
2054             }
2055             else {
2056 0     0   0 $self->{Methods}->{'start_dtd'} = sub { };
2057             }
2058             }
2059              
2060             }
2061              
2062             sub entity_decl {
2063 9     9 1 43 my $self = shift;
2064 9 50       23 if (defined $self->{Methods}->{'entity_decl'}) {
2065 0         0 $self->{Methods}->{'entity_decl'}->(@_);
2066             }
2067             else {
2068 9         10 my $method;
2069             my $callbacks;
2070 9 50       30 if (exists $self->{ParseOptions}) {
2071 0         0 $callbacks = $self->{ParseOptions};
2072             }
2073             else {
2074 9         10 $callbacks = $self;
2075             }
2076 9 100 100     157 if (0) { # dummy to make elsif's below compile
    100 66        
    100 50        
    50 66        
      33        
      50        
      33        
2077             }
2078 0 100       0 elsif (defined $callbacks->{'DTDHandler'} and $method = $callbacks->{'DTDHandler'}->can('entity_decl') ) {
2079 3         6 my $handler = $callbacks->{'DTDHandler'};
2080 3     0   13 $self->{Methods}->{'entity_decl'} = sub { $method->($handler, @_) };
  0         0  
2081 3         20 return $method->($handler, @_);
2082             }
2083             elsif (defined $callbacks->{'Handler'} and $method = $callbacks->{'Handler'}->can('entity_decl') ) {
2084 3         4 my $handler = $callbacks->{'Handler'};
2085 3     0   7 $self->{Methods}->{'entity_decl'} = sub { $method->($handler, @_) };
  0         0  
2086 3         8 return $method->($handler, @_);
2087             }
2088             elsif (defined $callbacks->{'DTDHandler'}
2089             and $callbacks->{'DTDHandler'}->can('AUTOLOAD')
2090             and $callbacks->{'DTDHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
2091             )
2092             {
2093 1         2 my $res = eval { $callbacks->{'DTDHandler'}->entity_decl(@_) };
  1         8  
2094 1 50       30 if ($@) {
2095 0         0 die $@;
2096             }
2097             else {
2098             # I think there's a buggette here...
2099             # if the first call throws an exception, we don't set it up right.
2100             # Not fatal, but we might want to address it.
2101 1         2 my $handler = $callbacks->{'DTDHandler'};
2102 1     0   2 $self->{Methods}->{'entity_decl'} = sub { $handler->entity_decl(@_) };
  0         0  
2103             }
2104 1         5 return $res;
2105             }
2106             elsif (defined $callbacks->{'Handler'}
2107             and $callbacks->{'Handler'}->can('AUTOLOAD')
2108             and $callbacks->{'Handler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
2109             )
2110             {
2111 2         3 my $res = eval { $callbacks->{'Handler'}->entity_decl(@_) };
  2         13  
2112 2 50       192 if ($@) {
2113 0         0 die $@;
2114             }
2115             else {
2116             # I think there's a buggette here...
2117             # if the first call throws an exception, we don't set it up right.
2118             # Not fatal, but we might want to address it.
2119 2         4 my $handler = $callbacks->{'Handler'};
2120 2     0   13 $self->{Methods}->{'entity_decl'} = sub { $handler->entity_decl(@_) };
  0         0  
2121             }
2122 2         10 return $res;
2123             }
2124             else {
2125 0     0   0 $self->{Methods}->{'entity_decl'} = sub { };
2126             }
2127             }
2128              
2129             }
2130              
2131             sub start_prefix_mapping {
2132 8     8 1 43 my $self = shift;
2133 8 50       19 if (defined $self->{Methods}->{'start_prefix_mapping'}) {
2134 0         0 $self->{Methods}->{'start_prefix_mapping'}->(@_);
2135             }
2136             else {
2137 8         7 my $method;
2138             my $callbacks;
2139 8 50       15 if (exists $self->{ParseOptions}) {
2140 0         0 $callbacks = $self->{ParseOptions};
2141             }
2142             else {
2143 8         14 $callbacks = $self;
2144             }
2145 8 100 100     160 if (0) { # dummy to make elsif's below compile
    100 66        
    100 50        
    50 66        
      33        
      50        
      33        
2146             }
2147 0 100       0 elsif (defined $callbacks->{'ContentHandler'} and $method = $callbacks->{'ContentHandler'}->can('start_prefix_mapping') ) {
2148 2         3 my $handler = $callbacks->{'ContentHandler'};
2149 2     0   9 $self->{Methods}->{'start_prefix_mapping'} = sub { $method->($handler, @_) };
  0         0  
2150 2         17 return $method->($handler, @_);
2151             }
2152             elsif (defined $callbacks->{'Handler'} and $method = $callbacks->{'Handler'}->can('start_prefix_mapping') ) {
2153 3         2 my $handler = $callbacks->{'Handler'};
2154 3     0   8 $self->{Methods}->{'start_prefix_mapping'} = sub { $method->($handler, @_) };
  0         0  
2155 3         10 return $method->($handler, @_);
2156             }
2157             elsif (defined $callbacks->{'ContentHandler'}
2158             and $callbacks->{'ContentHandler'}->can('AUTOLOAD')
2159             and $callbacks->{'ContentHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
2160             )
2161             {
2162 2         4 my $res = eval { $callbacks->{'ContentHandler'}->start_prefix_mapping(@_) };
  2         7  
2163 2 50       16 if ($@) {
2164 0         0 die $@;
2165             }
2166             else {
2167             # I think there's a buggette here...
2168             # if the first call throws an exception, we don't set it up right.
2169             # Not fatal, but we might want to address it.
2170 2         2 my $handler = $callbacks->{'ContentHandler'};
2171 2     0   7 $self->{Methods}->{'start_prefix_mapping'} = sub { $handler->start_prefix_mapping(@_) };
  0         0  
2172             }
2173 2         4 return $res;
2174             }
2175             elsif (defined $callbacks->{'Handler'}
2176             and $callbacks->{'Handler'}->can('AUTOLOAD')
2177             and $callbacks->{'Handler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
2178             )
2179             {
2180 1         3 my $res = eval { $callbacks->{'Handler'}->start_prefix_mapping(@_) };
  1         7  
2181 1 50       55 if ($@) {
2182 0         0 die $@;
2183             }
2184             else {
2185             # I think there's a buggette here...
2186             # if the first call throws an exception, we don't set it up right.
2187             # Not fatal, but we might want to address it.
2188 1         2 my $handler = $callbacks->{'Handler'};
2189 1     0   6 $self->{Methods}->{'start_prefix_mapping'} = sub { $handler->start_prefix_mapping(@_) };
  0         0  
2190             }
2191 1         3 return $res;
2192             }
2193             else {
2194 0     0   0 $self->{Methods}->{'start_prefix_mapping'} = sub { };
2195             }
2196             }
2197              
2198             }
2199              
2200             sub end_cdata {
2201 7     7 1 30 my $self = shift;
2202 7 50       21 if (defined $self->{Methods}->{'end_cdata'}) {
2203 0         0 $self->{Methods}->{'end_cdata'}->(@_);
2204             }
2205             else {
2206 7         8 my $method;
2207             my $callbacks;
2208 7 50       14 if (exists $self->{ParseOptions}) {
2209 0         0 $callbacks = $self->{ParseOptions};
2210             }
2211             else {
2212 7         7 $callbacks = $self;
2213             }
2214 7 50 100     137 if (0) { # dummy to make elsif's below compile
    100 100        
    100 33        
    50 0        
    100 33        
    50 66        
      50        
      66        
      33        
      50        
      33        
2215             }
2216 0 50       0 elsif (defined $callbacks->{'DocumentHandler'} and $method = $callbacks->{'DocumentHandler'}->can('end_cdata') ) {
2217 0         0 my $handler = $callbacks->{'DocumentHandler'};
2218 0     0   0 $self->{Methods}->{'end_cdata'} = sub { $method->($handler, @_) };
  0         0  
2219 0         0 return $method->($handler, @_);
2220             }
2221             elsif (defined $callbacks->{'LexicalHandler'} and $method = $callbacks->{'LexicalHandler'}->can('end_cdata') ) {
2222 2         3 my $handler = $callbacks->{'LexicalHandler'};
2223 2     0   10 $self->{Methods}->{'end_cdata'} = sub { $method->($handler, @_) };
  0         0  
2224 2         22 return $method->($handler, @_);
2225             }
2226             elsif (defined $callbacks->{'Handler'} and $method = $callbacks->{'Handler'}->can('end_cdata') ) {
2227 3         3 my $handler = $callbacks->{'Handler'};
2228 3     0   11 $self->{Methods}->{'end_cdata'} = sub { $method->($handler, @_) };
  0         0  
2229 3         10 return $method->($handler, @_);
2230             }
2231             elsif (defined $callbacks->{'DocumentHandler'}
2232             and $callbacks->{'DocumentHandler'}->can('AUTOLOAD')
2233             and $callbacks->{'DocumentHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
2234             )
2235             {
2236 0         0 my $res = eval { $callbacks->{'DocumentHandler'}->end_cdata(@_) };
  0         0  
2237 0 0       0 if ($@) {
2238 0         0 die $@;
2239             }
2240             else {
2241             # I think there's a buggette here...
2242             # if the first call throws an exception, we don't set it up right.
2243             # Not fatal, but we might want to address it.
2244 0         0 my $handler = $callbacks->{'DocumentHandler'};
2245 0     0   0 $self->{Methods}->{'end_cdata'} = sub { $handler->end_cdata(@_) };
  0         0  
2246             }
2247 0         0 return $res;
2248             }
2249             elsif (defined $callbacks->{'LexicalHandler'}
2250             and $callbacks->{'LexicalHandler'}->can('AUTOLOAD')
2251             and $callbacks->{'LexicalHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
2252             )
2253             {
2254 1         1 my $res = eval { $callbacks->{'LexicalHandler'}->end_cdata(@_) };
  1         10  
2255 1 50       32 if ($@) {
2256 0         0 die $@;
2257             }
2258             else {
2259             # I think there's a buggette here...
2260             # if the first call throws an exception, we don't set it up right.
2261             # Not fatal, but we might want to address it.
2262 1         1 my $handler = $callbacks->{'LexicalHandler'};
2263 1     0   4 $self->{Methods}->{'end_cdata'} = sub { $handler->end_cdata(@_) };
  0         0  
2264             }
2265 1         1 return $res;
2266             }
2267             elsif (defined $callbacks->{'Handler'}
2268             and $callbacks->{'Handler'}->can('AUTOLOAD')
2269             and $callbacks->{'Handler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
2270             )
2271             {
2272 1         2 my $res = eval { $callbacks->{'Handler'}->end_cdata(@_) };
  1         7  
2273 1 50       63 if ($@) {
2274 0         0 die $@;
2275             }
2276             else {
2277             # I think there's a buggette here...
2278             # if the first call throws an exception, we don't set it up right.
2279             # Not fatal, but we might want to address it.
2280 1         3 my $handler = $callbacks->{'Handler'};
2281 1     0   5 $self->{Methods}->{'end_cdata'} = sub { $handler->end_cdata(@_) };
  0         0  
2282             }
2283 1         3 return $res;
2284             }
2285             else {
2286 0     0   0 $self->{Methods}->{'end_cdata'} = sub { };
2287             }
2288             }
2289              
2290             }
2291              
2292             sub processing_instruction {
2293 12     12 1 64 my $self = shift;
2294 12 50       29 if (defined $self->{Methods}->{'processing_instruction'}) {
2295 0         0 $self->{Methods}->{'processing_instruction'}->(@_);
2296             }
2297             else {
2298 12         12 my $method;
2299             my $callbacks;
2300 12 50       19 if (exists $self->{ParseOptions}) {
2301 0         0 $callbacks = $self->{ParseOptions};
2302             }
2303             else {
2304 12         13 $callbacks = $self;
2305             }
2306 12 100 100     269 if (0) { # dummy to make elsif's below compile
    100 100        
    100 66        
    100 50        
    100 66        
    50 66        
      50        
      66        
      33        
      50        
      33        
2307             }
2308 0 100       0 elsif (defined $callbacks->{'ContentHandler'} and $method = $callbacks->{'ContentHandler'}->can('processing_instruction') ) {
2309 2         4 my $handler = $callbacks->{'ContentHandler'};
2310 2     0   8 $self->{Methods}->{'processing_instruction'} = sub { $method->($handler, @_) };
  0         0  
2311 2         21 return $method->($handler, @_);
2312             }
2313             elsif (defined $callbacks->{'DocumentHandler'} and $method = $callbacks->{'DocumentHandler'}->can('processing_instruction') ) {
2314 2         2 my $handler = $callbacks->{'DocumentHandler'};
2315 2     0   7 $self->{Methods}->{'processing_instruction'} = sub { $method->($handler, @_) };
  0         0  
2316 2         12 return $method->($handler, @_);
2317             }
2318             elsif (defined $callbacks->{'Handler'} and $method = $callbacks->{'Handler'}->can('processing_instruction') ) {
2319 3         4 my $handler = $callbacks->{'Handler'};
2320 3     0   9 $self->{Methods}->{'processing_instruction'} = sub { $method->($handler, @_) };
  0         0  
2321 3         14 return $method->($handler, @_);
2322             }
2323             elsif (defined $callbacks->{'ContentHandler'}
2324             and $callbacks->{'ContentHandler'}->can('AUTOLOAD')
2325             and $callbacks->{'ContentHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
2326             )
2327             {
2328 2         2 my $res = eval { $callbacks->{'ContentHandler'}->processing_instruction(@_) };
  2         9  
2329 2 50       25 if ($@) {
2330 0         0 die $@;
2331             }
2332             else {
2333             # I think there's a buggette here...
2334             # if the first call throws an exception, we don't set it up right.
2335             # Not fatal, but we might want to address it.
2336 2         2 my $handler = $callbacks->{'ContentHandler'};
2337 2     0   8 $self->{Methods}->{'processing_instruction'} = sub { $handler->processing_instruction(@_) };
  0         0  
2338             }
2339 2         5 return $res;
2340             }
2341             elsif (defined $callbacks->{'DocumentHandler'}
2342             and $callbacks->{'DocumentHandler'}->can('AUTOLOAD')
2343             and $callbacks->{'DocumentHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
2344             )
2345             {
2346 1         2 my $res = eval { $callbacks->{'DocumentHandler'}->processing_instruction(@_) };
  1         4  
2347 1 50       169 if ($@) {
2348 0         0 die $@;
2349             }
2350             else {
2351             # I think there's a buggette here...
2352             # if the first call throws an exception, we don't set it up right.
2353             # Not fatal, but we might want to address it.
2354 1         7 my $handler = $callbacks->{'DocumentHandler'};
2355 1     0   4 $self->{Methods}->{'processing_instruction'} = sub { $handler->processing_instruction(@_) };
  0         0  
2356             }
2357 1         3 return $res;
2358             }
2359             elsif (defined $callbacks->{'Handler'}
2360             and $callbacks->{'Handler'}->can('AUTOLOAD')
2361             and $callbacks->{'Handler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
2362             )
2363             {
2364 2         4 my $res = eval { $callbacks->{'Handler'}->processing_instruction(@_) };
  2         11  
2365 2 50       202 if ($@) {
2366 0         0 die $@;
2367             }
2368             else {
2369             # I think there's a buggette here...
2370             # if the first call throws an exception, we don't set it up right.
2371             # Not fatal, but we might want to address it.
2372 2         4 my $handler = $callbacks->{'Handler'};
2373 2     0   10 $self->{Methods}->{'processing_instruction'} = sub { $handler->processing_instruction(@_) };
  0         0  
2374             }
2375 2         6 return $res;
2376             }
2377             else {
2378 0     0   0 $self->{Methods}->{'processing_instruction'} = sub { };
2379             }
2380             }
2381              
2382             }
2383              
2384             sub end_element {
2385 12     12 1 74 my $self = shift;
2386 12 50       28 if (defined $self->{Methods}->{'end_element'}) {
2387 0         0 $self->{Methods}->{'end_element'}->(@_);
2388             }
2389             else {
2390 12         12 my $method;
2391             my $callbacks;
2392 12 50       21 if (exists $self->{ParseOptions}) {
2393 0         0 $callbacks = $self->{ParseOptions};
2394             }
2395             else {
2396 12         10 $callbacks = $self;
2397             }
2398 12 100 100     284 if (0) { # dummy to make elsif's below compile
    100 100        
    100 66        
    100 50        
    100 66        
    50 66        
      50        
      66        
      33        
      50        
      33        
2399             }
2400 0 100       0 elsif (defined $callbacks->{'ContentHandler'} and $method = $callbacks->{'ContentHandler'}->can('end_element') ) {
2401 2         3 my $handler = $callbacks->{'ContentHandler'};
2402 2     0   8 $self->{Methods}->{'end_element'} = sub { $method->($handler, @_) };
  0         0  
2403 2         13 return $method->($handler, @_);
2404             }
2405             elsif (defined $callbacks->{'DocumentHandler'} and $method = $callbacks->{'DocumentHandler'}->can('end_element') ) {
2406 2         3 my $handler = $callbacks->{'DocumentHandler'};
2407 2     0   11 $self->{Methods}->{'end_element'} = sub { $method->($handler, @_) };
  0         0  
2408 2         13 return $method->($handler, @_);
2409             }
2410             elsif (defined $callbacks->{'Handler'} and $method = $callbacks->{'Handler'}->can('end_element') ) {
2411 3         3 my $handler = $callbacks->{'Handler'};
2412 3     0   9 $self->{Methods}->{'end_element'} = sub { $method->($handler, @_) };
  0         0  
2413 3         9 return $method->($handler, @_);
2414             }
2415             elsif (defined $callbacks->{'ContentHandler'}
2416             and $callbacks->{'ContentHandler'}->can('AUTOLOAD')
2417             and $callbacks->{'ContentHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
2418             )
2419             {
2420 2         2 my $res = eval { $callbacks->{'ContentHandler'}->end_element(@_) };
  2         9  
2421 2 50       16 if ($@) {
2422 0         0 die $@;
2423             }
2424             else {
2425             # I think there's a buggette here...
2426             # if the first call throws an exception, we don't set it up right.
2427             # Not fatal, but we might want to address it.
2428 2         2 my $handler = $callbacks->{'ContentHandler'};
2429 2     0   9 $self->{Methods}->{'end_element'} = sub { $handler->end_element(@_) };
  0         0  
2430             }
2431 2         4 return $res;
2432             }
2433             elsif (defined $callbacks->{'DocumentHandler'}
2434             and $callbacks->{'DocumentHandler'}->can('AUTOLOAD')
2435             and $callbacks->{'DocumentHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
2436             )
2437             {
2438 1         1 my $res = eval { $callbacks->{'DocumentHandler'}->end_element(@_) };
  1         5  
2439 1 50       144 if ($@) {
2440 0         0 die $@;
2441             }
2442             else {
2443             # I think there's a buggette here...
2444             # if the first call throws an exception, we don't set it up right.
2445             # Not fatal, but we might want to address it.
2446 1         1 my $handler = $callbacks->{'DocumentHandler'};
2447 1     0   5 $self->{Methods}->{'end_element'} = sub { $handler->end_element(@_) };
  0         0  
2448             }
2449 1         3 return $res;
2450             }
2451             elsif (defined $callbacks->{'Handler'}
2452             and $callbacks->{'Handler'}->can('AUTOLOAD')
2453             and $callbacks->{'Handler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
2454             )
2455             {
2456 2         4 my $res = eval { $callbacks->{'Handler'}->end_element(@_) };
  2         12  
2457 2 50       219 if ($@) {
2458 0         0 die $@;
2459             }
2460             else {
2461             # I think there's a buggette here...
2462             # if the first call throws an exception, we don't set it up right.
2463             # Not fatal, but we might want to address it.
2464 2         5 my $handler = $callbacks->{'Handler'};
2465 2     0   15 $self->{Methods}->{'end_element'} = sub { $handler->end_element(@_) };
  0         0  
2466             }
2467 2         7 return $res;
2468             }
2469             else {
2470 0     0   0 $self->{Methods}->{'end_element'} = sub { };
2471             }
2472             }
2473              
2474             }
2475              
2476             sub start_cdata {
2477 7     7 1 30 my $self = shift;
2478 7 50       17 if (defined $self->{Methods}->{'start_cdata'}) {
2479 0         0 $self->{Methods}->{'start_cdata'}->(@_);
2480             }
2481             else {
2482 7         6 my $method;
2483             my $callbacks;
2484 7 50       14 if (exists $self->{ParseOptions}) {
2485 0         0 $callbacks = $self->{ParseOptions};
2486             }
2487             else {
2488 7         8 $callbacks = $self;
2489             }
2490 7 50 100     188 if (0) { # dummy to make elsif's below compile
    100 100        
    100 33        
    50 0        
    100 33        
    50 66        
      50        
      66        
      33        
      50        
      33        
2491             }
2492 0 50       0 elsif (defined $callbacks->{'DocumentHandler'} and $method = $callbacks->{'DocumentHandler'}->can('start_cdata') ) {
2493 0         0 my $handler = $callbacks->{'DocumentHandler'};
2494 0     0   0 $self->{Methods}->{'start_cdata'} = sub { $method->($handler, @_) };
  0         0  
2495 0         0 return $method->($handler, @_);
2496             }
2497             elsif (defined $callbacks->{'LexicalHandler'} and $method = $callbacks->{'LexicalHandler'}->can('start_cdata') ) {
2498 2         3 my $handler = $callbacks->{'LexicalHandler'};
2499 2     0   9 $self->{Methods}->{'start_cdata'} = sub { $method->($handler, @_) };
  0         0  
2500 2         13 return $method->($handler, @_);
2501             }
2502             elsif (defined $callbacks->{'Handler'} and $method = $callbacks->{'Handler'}->can('start_cdata') ) {
2503 3         3 my $handler = $callbacks->{'Handler'};
2504 3     0   8 $self->{Methods}->{'start_cdata'} = sub { $method->($handler, @_) };
  0         0  
2505 3         10 return $method->($handler, @_);
2506             }
2507             elsif (defined $callbacks->{'DocumentHandler'}
2508             and $callbacks->{'DocumentHandler'}->can('AUTOLOAD')
2509             and $callbacks->{'DocumentHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
2510             )
2511             {
2512 0         0 my $res = eval { $callbacks->{'DocumentHandler'}->start_cdata(@_) };
  0         0  
2513 0 0       0 if ($@) {
2514 0         0 die $@;
2515             }
2516             else {
2517             # I think there's a buggette here...
2518             # if the first call throws an exception, we don't set it up right.
2519             # Not fatal, but we might want to address it.
2520 0         0 my $handler = $callbacks->{'DocumentHandler'};
2521 0     0   0 $self->{Methods}->{'start_cdata'} = sub { $handler->start_cdata(@_) };
  0         0  
2522             }
2523 0         0 return $res;
2524             }
2525             elsif (defined $callbacks->{'LexicalHandler'}
2526             and $callbacks->{'LexicalHandler'}->can('AUTOLOAD')
2527             and $callbacks->{'LexicalHandler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
2528             )
2529             {
2530 1         2 my $res = eval { $callbacks->{'LexicalHandler'}->start_cdata(@_) };
  1         8  
2531 1 50       36 if ($@) {
2532 0         0 die $@;
2533             }
2534             else {
2535             # I think there's a buggette here...
2536             # if the first call throws an exception, we don't set it up right.
2537             # Not fatal, but we might want to address it.
2538 1         1 my $handler = $callbacks->{'LexicalHandler'};
2539 1     0   5 $self->{Methods}->{'start_cdata'} = sub { $handler->start_cdata(@_) };
  0         0  
2540             }
2541 1         2 return $res;
2542             }
2543             elsif (defined $callbacks->{'Handler'}
2544             and $callbacks->{'Handler'}->can('AUTOLOAD')
2545             and $callbacks->{'Handler'}->can('AUTOLOAD') ne (UNIVERSAL->can('AUTOLOAD') || '')
2546             )
2547             {
2548 1         2 my $res = eval { $callbacks->{'Handler'}->start_cdata(@_) };
  1         7  
2549 1 50       68 if ($@) {
2550 0         0 die $@;
2551             }
2552             else {
2553             # I think there's a buggette here...
2554             # if the first call throws an exception, we don't set it up right.
2555             # Not fatal, but we might want to address it.
2556 1         2 my $handler = $callbacks->{'Handler'};
2557 1     0   6 $self->{Methods}->{'start_cdata'} = sub { $handler->start_cdata(@_) };
  0         0  
2558             }
2559 1         4 return $res;
2560             }
2561             else {
2562 0     0   0 $self->{Methods}->{'start_cdata'} = sub { };
2563             }
2564             }
2565              
2566             }
2567              
2568             #-------------------------------------------------------------------#
2569             # Class->new(%options)
2570             #-------------------------------------------------------------------#
2571             sub new {
2572 41     41 0 5099 my $proto = shift;
2573 41   33     156 my $class = ref($proto) || $proto;
2574 41 50       125 my $options = ($#_ == 0) ? shift : { @_ };
2575              
2576 41 100 100     365 unless ( defined( $options->{Handler} ) or
      100        
      100        
      100        
      100        
      100        
2577             defined( $options->{ContentHandler} ) or
2578             defined( $options->{DTDHandler} ) or
2579             defined( $options->{DocumentHandler} ) or
2580             defined( $options->{LexicalHandler} ) or
2581             defined( $options->{ErrorHandler} ) or
2582             defined( $options->{DeclHandler} ) ) {
2583            
2584 10         38 $options->{Handler} = XML::SAX::Base::NoHandler->new;
2585             }
2586              
2587 41         53 my $self = bless $options, $class;
2588             # turn NS processing on by default
2589 41         139 $self->set_feature('http://xml.org/sax/features/namespaces', 1);
2590 41         79 return $self;
2591             }
2592             #-------------------------------------------------------------------#
2593              
2594             #-------------------------------------------------------------------#
2595             # $p->parse(%options)
2596             #-------------------------------------------------------------------#
2597             sub parse {
2598 0     0 1 0 my $self = shift;
2599 0         0 my $parse_options = $self->get_options(@_);
2600 0         0 local $self->{ParseOptions} = $parse_options;
2601 0 0       0 if ($self->{Parent}) { # calling parse on a filter for some reason
2602 0         0 return $self->{Parent}->parse($parse_options);
2603             }
2604             else {
2605 0         0 my $method;
2606 0 0 0     0 if (defined $parse_options->{Source}{CharacterStream} and $method = $self->can('_parse_characterstream')) {
    0 0        
    0 0        
    0 0        
2607 0         0 warn("parse charstream???\n");
2608 0         0 return $method->($self, $parse_options->{Source}{CharacterStream});
2609             }
2610             elsif (defined $parse_options->{Source}{ByteStream} and $method = $self->can('_parse_bytestream')) {
2611 0         0 return $method->($self, $parse_options->{Source}{ByteStream});
2612             }
2613             elsif (defined $parse_options->{Source}{String} and $method = $self->can('_parse_string')) {
2614 0         0 return $method->($self, $parse_options->{Source}{String});
2615             }
2616             elsif (defined $parse_options->{Source}{SystemId} and $method = $self->can('_parse_systemid')) {
2617 0         0 return $method->($self, $parse_options->{Source}{SystemId});
2618             }
2619             else {
2620 0         0 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]";
2621             }
2622             }
2623             }
2624             #-------------------------------------------------------------------#
2625              
2626             #-------------------------------------------------------------------#
2627             # $p->parse_file(%options)
2628             #-------------------------------------------------------------------#
2629             sub parse_file {
2630 0     0 1 0 my $self = shift;
2631 0         0 my $file = shift;
2632 0 0       0 return $self->parse_uri($file, @_) if ref(\$file) eq 'SCALAR';
2633 0         0 my $parse_options = $self->get_options(@_);
2634 0         0 $parse_options->{Source}{ByteStream} = $file;
2635 0         0 return $self->parse($parse_options);
2636             }
2637             #-------------------------------------------------------------------#
2638              
2639             #-------------------------------------------------------------------#
2640             # $p->parse_uri(%options)
2641             #-------------------------------------------------------------------#
2642             sub parse_uri {
2643 0     0 1 0 my $self = shift;
2644 0         0 my $file = shift;
2645 0         0 my $parse_options = $self->get_options(@_);
2646 0         0 $parse_options->{Source}{SystemId} = $file;
2647 0         0 return $self->parse($parse_options);
2648             }
2649             #-------------------------------------------------------------------#
2650              
2651             #-------------------------------------------------------------------#
2652             # $p->parse_string(%options)
2653             #-------------------------------------------------------------------#
2654             sub parse_string {
2655 0     0 1 0 my $self = shift;
2656 0         0 my $string = shift;
2657 0         0 my $parse_options = $self->get_options(@_);
2658 0         0 $parse_options->{Source}{String} = $string;
2659 0         0 return $self->parse($parse_options);
2660             }
2661             #-------------------------------------------------------------------#
2662              
2663             #-------------------------------------------------------------------#
2664             # get_options
2665             #-------------------------------------------------------------------#
2666             sub get_options {
2667 0     0 1 0 my $self = shift;
2668              
2669 0 0       0 if (@_ == 1) {
2670 0         0 return { %$self, %{$_[0]} };
  0         0  
2671             } else {
2672 0         0 return { %$self, @_ };
2673             }
2674             }
2675             #-------------------------------------------------------------------#
2676              
2677             #-------------------------------------------------------------------#
2678             # get_features
2679             #-------------------------------------------------------------------#
2680             sub get_features {
2681             return (
2682 41     41 0 330 'http://xml.org/sax/features/external-general-entities' => undef,
2683             'http://xml.org/sax/features/external-parameter-entities' => undef,
2684             'http://xml.org/sax/features/is-standalone' => undef,
2685             'http://xml.org/sax/features/lexical-handler' => undef,
2686             'http://xml.org/sax/features/parameter-entities' => undef,
2687             'http://xml.org/sax/features/namespaces' => 1,
2688             'http://xml.org/sax/features/namespace-prefixes' => 0,
2689             'http://xml.org/sax/features/string-interning' => undef,
2690             'http://xml.org/sax/features/use-attributes2' => undef,
2691             'http://xml.org/sax/features/use-locator2' => undef,
2692             'http://xml.org/sax/features/validation' => undef,
2693              
2694             'http://xml.org/sax/properties/dom-node' => undef,
2695             'http://xml.org/sax/properties/xml-string' => undef,
2696             );
2697             }
2698             #-------------------------------------------------------------------#
2699              
2700             #-------------------------------------------------------------------#
2701             # get_feature
2702             #-------------------------------------------------------------------#
2703             sub get_feature {
2704 0     0 1 0 my $self = shift;
2705 0         0 my $feat = shift;
2706              
2707             # check %FEATURES to see if it's there, and return it if so
2708             # throw XML::SAX::Exception::NotRecognized if it's not there
2709             # throw XML::SAX::Exception::NotSupported if it's there but we
2710             # don't support it
2711            
2712 0         0 my %features = $self->get_features();
2713 0 0       0 if (exists $features{$feat}) {
2714 0         0 my %supported = map { $_ => 1 } $self->supported_features();
  0         0  
2715 0 0       0 if ($supported{$feat}) {
2716 0         0 return $self->{__PACKAGE__ . "::Features"}{$feat};
2717             }
2718             throw XML::SAX::Exception::NotSupported(
2719 0         0 Message => "The feature '$feat' is not supported by " . ref($self),
2720             Exception => undef,
2721             );
2722             }
2723             throw XML::SAX::Exception::NotRecognized(
2724 0         0 Message => "The feature '$feat' is not recognized by " . ref($self),
2725             Exception => undef,
2726             );
2727             }
2728             #-------------------------------------------------------------------#
2729              
2730             #-------------------------------------------------------------------#
2731             # set_feature
2732             #-------------------------------------------------------------------#
2733             sub set_feature {
2734 41     41 1 38 my $self = shift;
2735 41         45 my $feat = shift;
2736 41         38 my $value = shift;
2737             # check %FEATURES to see if it's there, and set it if so
2738             # throw XML::SAX::Exception::NotRecognized if it's not there
2739             # throw XML::SAX::Exception::NotSupported if it's there but we
2740             # don't support it
2741            
2742 41         124 my %features = $self->get_features();
2743 41 50       121 if (exists $features{$feat}) {
2744 41         145 my %supported = map { $_ => 1 } $self->supported_features();
  41         97  
2745 41 50       95 if ($supported{$feat}) {
2746 41         207 return $self->{__PACKAGE__ . "::Features"}{$feat} = $value;
2747             }
2748             throw XML::SAX::Exception::NotSupported(
2749 0         0 Message => "The feature '$feat' is not supported by " . ref($self),
2750             Exception => undef,
2751             );
2752             }
2753             throw XML::SAX::Exception::NotRecognized(
2754 0         0 Message => "The feature '$feat' is not recognized by " . ref($self),
2755             Exception => undef,
2756             );
2757             }
2758             #-------------------------------------------------------------------#
2759              
2760             #-------------------------------------------------------------------#
2761             # get_handler and friends
2762             #-------------------------------------------------------------------#
2763             sub get_handler {
2764 2     2 1 7 my $self = shift;
2765 2         2 my $handler_type = shift;
2766 2   50     5 $handler_type ||= 'Handler';
2767 2 50       14 return defined( $self->{$handler_type} ) ? $self->{$handler_type} : undef;
2768             }
2769              
2770             sub get_document_handler {
2771 0     0 1 0 my $self = shift;
2772 0         0 return $self->get_handler('DocumentHandler', @_);
2773             }
2774              
2775             sub get_content_handler {
2776 1     1 1 2 my $self = shift;
2777 1         3 return $self->get_handler('ContentHandler', @_);
2778             }
2779              
2780             sub get_dtd_handler {
2781 0     0 1 0 my $self = shift;
2782 0         0 return $self->get_handler('DTDHandler', @_);
2783             }
2784              
2785             sub get_lexical_handler {
2786 0     0 1 0 my $self = shift;
2787 0         0 return $self->get_handler('LexicalHandler', @_);
2788             }
2789              
2790             sub get_decl_handler {
2791 0     0 1 0 my $self = shift;
2792 0         0 return $self->get_handler('DeclHandler', @_);
2793             }
2794              
2795             sub get_error_handler {
2796 0     0 1 0 my $self = shift;
2797 0         0 return $self->get_handler('ErrorHandler', @_);
2798             }
2799              
2800             sub get_entity_resolver {
2801 0     0 1 0 my $self = shift;
2802 0         0 return $self->get_handler('EntityResolver', @_);
2803             }
2804             #-------------------------------------------------------------------#
2805              
2806             #-------------------------------------------------------------------#
2807             # set_handler and friends
2808             #-------------------------------------------------------------------#
2809             sub set_handler {
2810 4     4 1 4 my $self = shift;
2811 4         8 my ($new_handler, $handler_type) = reverse @_;
2812 4   50     8 $handler_type ||= 'Handler';
2813 4 100       12 $self->{Methods} = {} if $self->{Methods};
2814 4         10 $self->{$handler_type} = $new_handler;
2815 4         6 $self->{ParseOptions}->{$handler_type} = $new_handler;
2816 4         9 return 1;
2817             }
2818              
2819             sub set_document_handler {
2820 1     1 1 6 my $self = shift;
2821 1         5 return $self->set_handler('DocumentHandler', @_);
2822             }
2823              
2824             sub set_content_handler {
2825 2     2 1 4 my $self = shift;
2826 2         6 return $self->set_handler('ContentHandler', @_);
2827             }
2828             sub set_dtd_handler {
2829 0     0 1 0 my $self = shift;
2830 0         0 return $self->set_handler('DTDHandler', @_);
2831             }
2832             sub set_lexical_handler {
2833 0     0 1 0 my $self = shift;
2834 0         0 return $self->set_handler('LexicalHandler', @_);
2835             }
2836             sub set_decl_handler {
2837 0     0 1 0 my $self = shift;
2838 0         0 return $self->set_handler('DeclHandler', @_);
2839             }
2840             sub set_error_handler {
2841 0     0 1 0 my $self = shift;
2842 0         0 return $self->set_handler('ErrorHandler', @_);
2843             }
2844             sub set_entity_resolver {
2845 0     0 1 0 my $self = shift;
2846 0         0 return $self->set_handler('EntityResolver', @_);
2847             }
2848              
2849             #-------------------------------------------------------------------#
2850              
2851             #-------------------------------------------------------------------#
2852             # supported_features
2853             #-------------------------------------------------------------------#
2854             sub supported_features {
2855 41     41 0 39 my $self = shift;
2856             # Only namespaces are required by all parsers
2857             return (
2858 41         58 'http://xml.org/sax/features/namespaces',
2859             );
2860             }
2861             #-------------------------------------------------------------------#
2862              
2863       0 0   sub no_op {
2864             # this space intentionally blank
2865             }
2866              
2867              
2868             package XML::SAX::Base::NoHandler;
2869             $XML::SAX::Base::NoHandler::VERSION = '1.09';
2870             # we need a fake handler that doesn't implement anything, this
2871             # simplifies the code a lot (though given the recent changes,
2872             # it may be better to do without)
2873             sub new {
2874             #warn "no handler called\n";
2875 10     10   16 return bless {};
2876             }
2877              
2878             1;
2879              
2880             __END__