1 # $Id: DebugHandler.pm,v 1.3 2001/11/24 17:47:53 matt Exp $ |
|
2 |
|
3 package XML::SAX::PurePerl::DebugHandler; |
|
4 |
|
5 use strict; |
|
6 |
|
7 sub new { |
|
8 my $class = shift; |
|
9 my %opts = @_; |
|
10 return bless \%opts, $class; |
|
11 } |
|
12 |
|
13 # DocumentHandler |
|
14 |
|
15 sub set_document_locator { |
|
16 my $self = shift; |
|
17 print "set_document_locator\n" if $ENV{DEBUG_XML}; |
|
18 $self->{seen}{set_document_locator}++; |
|
19 } |
|
20 |
|
21 sub start_document { |
|
22 my $self = shift; |
|
23 print "start_document\n" if $ENV{DEBUG_XML}; |
|
24 $self->{seen}{start_document}++; |
|
25 } |
|
26 |
|
27 sub end_document { |
|
28 my $self = shift; |
|
29 print "end_document\n" if $ENV{DEBUG_XML}; |
|
30 $self->{seen}{end_document}++; |
|
31 } |
|
32 |
|
33 sub start_element { |
|
34 my $self = shift; |
|
35 print "start_element\n" if $ENV{DEBUG_XML}; |
|
36 $self->{seen}{start_element}++; |
|
37 } |
|
38 |
|
39 sub end_element { |
|
40 my $self = shift; |
|
41 print "end_element\n" if $ENV{DEBUG_XML}; |
|
42 $self->{seen}{end_element}++; |
|
43 } |
|
44 |
|
45 sub characters { |
|
46 my $self = shift; |
|
47 print "characters\n" if $ENV{DEBUG_XML}; |
|
48 # warn "Char: ", $_[0]->{Data}, "\n"; |
|
49 $self->{seen}{characters}++; |
|
50 } |
|
51 |
|
52 sub processing_instruction { |
|
53 my $self = shift; |
|
54 print "processing_instruction\n" if $ENV{DEBUG_XML}; |
|
55 $self->{seen}{processing_instruction}++; |
|
56 } |
|
57 |
|
58 sub ignorable_whitespace { |
|
59 my $self = shift; |
|
60 print "ignorable_whitespace\n" if $ENV{DEBUG_XML}; |
|
61 $self->{seen}{ignorable_whitespace}++; |
|
62 } |
|
63 |
|
64 # LexHandler |
|
65 |
|
66 sub comment { |
|
67 my $self = shift; |
|
68 print "comment\n" if $ENV{DEBUG_XML}; |
|
69 $self->{seen}{comment}++; |
|
70 } |
|
71 |
|
72 # DTDHandler |
|
73 |
|
74 sub notation_decl { |
|
75 my $self = shift; |
|
76 print "notation_decl\n" if $ENV{DEBUG_XML}; |
|
77 $self->{seen}{notation_decl}++; |
|
78 } |
|
79 |
|
80 sub unparsed_entity_decl { |
|
81 my $self = shift; |
|
82 print "unparsed_entity_decl\n" if $ENV{DEBUG_XML}; |
|
83 $self->{seen}{entity_decl}++; |
|
84 } |
|
85 |
|
86 # EntityResolver |
|
87 |
|
88 sub resolve_entity { |
|
89 my $self = shift; |
|
90 print "resolve_entity\n" if $ENV{DEBUG_XML}; |
|
91 $self->{seen}{resolve_entity}++; |
|
92 return ''; |
|
93 } |
|
94 |
|
95 1; |
|