This file is indexed.

/usr/share/perl5/XML/SAX2Perl.pm is in libxml-perl 0.08-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
#
# Copyright (C) 1998 Ken MacLeod
# XML::SAX2Perl is free software; you can redistribute it and/or
# modify it under the same terms as Perl itself.
#
# $Id: SAX2Perl.pm,v 1.4 2001/07/23 15:47:15 kmacleod Exp $
#

use strict;

package XML::SAX2Perl;

use vars qw{ $VERSION };

# will be substituted by make-rel script
$VERSION = "0.08";

sub new {
    my $type = shift;
    my $self = ($#_ == 0) ? shift : { @_ };

    return bless $self, $type;
}

sub setDocumentLocator {
    my $self = shift;
    my $self->{Locator} = shift;
}

sub startDocument {
    my $self = shift;

    my @properties;
    if (defined $self->{Locator}) {
	push @properties, locator => $self->{Locator};
    }

    $self->{DocumentHandler}->start_document(@properties);
}

sub endDocument {
    my $self = shift;

    $self->{DocumentHandler}->end_document;
}

sub startElement {
    my $self = shift;
    my $name = shift;
    my $attributes = shift;

    # FIXME depends on how Perl SAX treats attributes
    $self->{DocumentHandler}->start_element(Name => $name, Attributes => $attributes);
}

sub endElement {
    my $self = shift;
    my $name = shift;

    $self->{DocumentHandler}->end_element(Name => $name);
}

sub characters {
    my $self = shift;
    my $ch = shift;
    my $start = shift;
    my $length = shift;

    $self->{DocumentHandler}->characters(Data => substr($ch, $start, $length));
}

sub ignorableWhitespace {
    my $self = shift;
    my $ch = shift;
    my $start = shift;
    my $length = shift;

    $self->{DocumentHandler}->ignorable_whitespace(Data => substr($ch, $start, $length));
}

sub processingInstruction {
    my $self = shift;
    my $target = shift;
    my $data = shift;

    $self->{DocumentHandler}->processing_instruction(Target => $target, Data => $data);
}

1;

__END__

=head1 NAME

XML::SAX2Perl -- translate Java/CORBA style SAX methods to Perl methods

=head1 SYNOPSIS

 use XML::SAX2Perl;

 $sax2perl = XML::SAX2Perl(Handler => $my_handler);
 $sax->setDocumentHandler($sax2perl);

=head1 DESCRIPTION

C<XML::SAX2Perl> is a SAX filter that translates Java/CORBA style SAX
methods to Perl style method calls.  This man page summarizes the
specific options, handlers, and properties supported by
C<XML::SAX2Perl>; please refer to the Perl SAX standard C<XML::SAX>
for general usage information.

=head1 METHODS

=over 4

=item new

Creates a new parser object.  Default options for parsing, described
below, are passed as key-value pairs or as a single hash.  Options may
be changed directly in the parser object unless stated otherwise.
Options passed to `C<parse()>' override the default options in the
parser object for the duration of the parse.

=item parse

Parses a document.  Options, described below, are passed as key-value
pairs or as a single hash.  Options passed to `C<parse()>' override
default options in the parser object.

=item location

Returns the location as a hash:

  ColumnNumber    The column number of the parse.
  LineNumber      The line number of the parse.
  PublicId        A string containing the public identifier, or undef
                  if none is available.
  SystemId        A string containing the system identifier, or undef
                  if none is available.

=item SAX DocumentHandler Methods

The following methods are DocumentHandler methods that the SAX 1.0
parser will call and C<XML::SAX2Perl> will translate to Perl SAX
methods calls.  See SAX 1.0 for details.

 setDocumentLocator(locator)
 startDocument()
 endDocument()
 startElement(name, atts)
 endElement(name)
 characters(ch, start, length)
 ignorableWhitespace(ch, start, length)
 processingInstruction(target, data)

=back

=head1 OPTIONS

The following options are supported by C<XML::SAX2Perl>:

 Handler          default handler to receive events
 DocumentHandler  handler to receive document events
 DTDHandler       handler to receive DTD events
 ErrorHandler     handler to receive error events
 EntityResolver   handler to resolve entities
 Locale           locale to provide localisation for errors
 Source           hash containing the input source for parsing

If no handlers are provided then all events will be silently ignored,
except for `C<fatal_error()>' which will cause a `C<die()>' to be
called after calling `C<end_document()>'.

If a single string argument is passed to the `C<parse()>' method, it
is treated as if a `C<Source>' option was given with a `C<String>'
parameter.

The `C<Source>' hash may contain the following parameters:

 ByteStream       The raw byte stream (file handle) containing the
                  document.
 String           A string containing the document.
 SystemId         The system identifier (URI) of the document.
 PublicId         The public identifier.
 Encoding         A string describing the character encoding.

If more than one of `C<ByteStream>', `C<String>', or `C<SystemId>',
then preference is given first to `C<ByteStream>', then `C<String>',
then `C<SystemId>'.

=head1 HANDLERS

The following handlers and properties are supported by
C<XML::SAX2Perl>:

=head2 DocumentHandler methods

=over 4

=item start_document

Receive notification of the beginning of a document. 

 Locator          An object that can return the location of any SAX
                  document event.

=item end_document

Receive notification of the end of a document. 

No properties defined.

=item start_element

Receive notification of the beginning of an element. 

 Name             The element type name.
 Attributes       Attributes attached to the element, if any.

ALPHA WARNING: The `C<Attributes>' value is not translated from the
SAX 1.0 value, so it will contain an AttributeList object.

=item end_element

Receive notification of the end of an element. 

 Name             The element type name.

=item characters

Receive notification of character data. 

 Data             The characters from the XML document.

=item ignorable_whitespace

Receive notification of ignorable whitespace in element content. 

 Data             The characters from the XML document.

=item processing_instruction

Receive notification of a processing instruction. 

 Target           The processing instruction target. 
 Data             The processing instruction data, if any.

=back

=head1 AUTHOR

Ken MacLeod <ken@bitsko.slc.ut.us>

=head1 SEE ALSO

perl(1), XML::Perl2SAX(3).

 Extensible Markup Language (XML) <http://www.w3c.org/XML/>
 Simple API for XML (SAX) <http://www.megginson.com/SAX/>

=cut