File Coverage

blib/lib/XML/SAX/Base.pm
Criterion Covered Total %
statement 905 1402 64.5
branch 479 690 69.4
condition 458 785 58.3
subroutine 49 252 19.4
pod 56 60 93.3
total 1947 3189 61.0


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