|
Packit |
d27c7e |
=head1 Priorities
|
|
Packit |
d27c7e |
|
|
Packit |
d27c7e |
Larry Wall suggests, ``In the absence of other considerations, I'd
|
|
Packit |
d27c7e |
encourage you to provide the cleanest interface from the user's
|
|
Packit |
d27c7e |
standpoint, and let the implementer worry about the details.''
|
|
Packit |
d27c7e |
|
|
Packit |
d27c7e |
=head1 Naming
|
|
Packit |
d27c7e |
|
|
Packit |
d27c7e |
B<Still Undecided:>
|
|
Packit |
d27c7e |
|
|
Packit |
d27c7e |
All method names use lower-case, `C<_>' seperated names.
|
|
Packit |
d27c7e |
|
|
Packit |
d27c7e |
B<or>
|
|
Packit |
d27c7e |
|
|
Packit |
d27c7e |
All method names match their Java counterparts.
|
|
Packit |
d27c7e |
|
|
Packit |
d27c7e |
All options, parameters, and property names use mixed case names, with
|
|
Packit |
d27c7e |
an initial upper case character. This eliminates a certain amount of
|
|
Packit |
d27c7e |
potential confusion with reserved words, which, for the most part, are
|
|
Packit |
d27c7e |
lower case.
|
|
Packit |
d27c7e |
|
|
Packit |
d27c7e |
The following words are abbreviated in method names and parameters:
|
|
Packit |
d27c7e |
|
|
Packit |
d27c7e |
Declaration decl Decl
|
|
Packit |
d27c7e |
Reference ref Ref
|
|
Packit |
d27c7e |
Identifier id Id
|
|
Packit |
d27c7e |
|
|
Packit |
d27c7e |
=head1 Object Instantiation and Options
|
|
Packit |
d27c7e |
|
|
Packit |
d27c7e |
For creating new parser or handler objects, the `new' methods accept a
|
|
Packit |
d27c7e |
list of key-value pairs (C<=E<gt>>) or a hash containing the options.
|
|
Packit |
d27c7e |
The key names are derived from the SAX positional parameter names
|
|
Packit |
d27c7e |
(`C<Source>' and `C<SystemId>' in Parser's `C<parse()>') or the name of
|
|
Packit |
d27c7e |
option setting methods (`C<DocumentHandler>', `C<DTDHandler>',
|
|
Packit |
d27c7e |
`C<EntityResolver>', `C<ErrorHandler>', and `C<Locale>' in Parser).
|
|
Packit |
d27c7e |
|
|
Packit |
d27c7e |
Callers may get and set options directly in the object, for example:
|
|
Packit |
d27c7e |
|
|
Packit |
d27c7e |
$parser = SAX::Parser->new( Source => { ByteStream => $fh },
|
|
Packit |
d27c7e |
DocumentHandler => $doc_handler );
|
|
Packit |
d27c7e |
|
|
Packit |
d27c7e |
$parser->{Locale} = 'el_GR.ISO-8859-7';
|
|
Packit |
d27c7e |
|
|
Packit |
d27c7e |
There are no set/get methods in the Perl SAX API.
|
|
Packit |
d27c7e |
|
|
Packit |
d27c7e |
=head1 Handler Calls
|
|
Packit |
d27c7e |
|
|
Packit |
d27c7e |
Handler calls all take hashes instead of positional parameters. Key
|
|
Packit |
d27c7e |
names are derived from SAX positional parameter names. This allows
|
|
Packit |
d27c7e |
parsers and filters to provide additional parameters if they can or
|
|
Packit |
d27c7e |
the user requests it.
|
|
Packit |
d27c7e |
|
|
Packit |
d27c7e |
=head1 Extending Handler Interfaces
|
|
Packit |
d27c7e |
|
|
Packit |
d27c7e |
Developers of event-generators can extend the handler interface as
|
|
Packit |
d27c7e |
they need to. Event-generators that use an extended interface should
|
|
Packit |
d27c7e |
accept generator options or use `C<can>' to test whether a handler can
|
|
Packit |
d27c7e |
support their extended interface.
|
|
Packit |
d27c7e |
|
|
Packit |
d27c7e |
For example, a C<DocumentHandler> that wants to receive internal
|
|
Packit |
d27c7e |
entity events instead of having them resolved and passed in to the
|
|
Packit |
d27c7e |
`C<characters>' method would define a `C<internal_entity>' method
|
|
Packit |
d27c7e |
and/or set a parser option to pass or not pass internal entity events.
|
|
Packit |
d27c7e |
|
|
Packit |
d27c7e |
=head1 Helper Classes
|
|
Packit |
d27c7e |
|
|
Packit |
d27c7e |
Perl SAX avoids helper classes (like SAXException and InputSource)
|
|
Packit |
d27c7e |
where those classes only hold information and have no behavior. In
|
|
Packit |
d27c7e |
those cases, simple hashes are used instead.
|
|
Packit |
d27c7e |
|
|
Packit |
d27c7e |
B<It is still undecided> if these should be implemented anyway for
|
|
Packit |
d27c7e |
easier portability.
|
|
Packit |
d27c7e |
|
|
Packit |
d27c7e |
=head1 Contributors
|
|
Packit |
d27c7e |
|
|
Packit |
d27c7e |
Eduard (Enno) Derksen
|
|
Packit |
d27c7e |
Ken MacLeod
|
|
Packit |
d27c7e |
Eric Prud'hommeaux
|
|
Packit |
d27c7e |
Larry Wall
|