XML::SAX::DocumentLocator - Helper class for document locators
my $locator = XML::SAX::DocumentLocator->new( sub { $object->get_public_id }, sub { $object->get_system_id }, sub { $reader->current_line }, sub { $reader->current_column }, sub { $reader->get_encoding }, sub { $reader->get_xml_version }, );
User Contributed Perl Documentation SAX::DocumentLocator(3) NAME XML::SAX::DocumentLocator - Helper class for document locators SYNOPSIS my $locator = XML::SAX::DocumentLocator->new( sub { $object->get_public_id }, sub { $object->get_system_id }, sub { $reader->current_line }, sub { $reader->current_column }, sub { $reader->get_encoding }, sub { $reader->get_xml_version }, ); DESCRIPTION This module gives you a tied hash reference that calls the specified closures when asked for PublicId, SystemId, LineNumber and ColumnNumber. It is useful for writing SAX Parsers so that you don't have to constantly update the line numbers in a hash reference on the object you pass to set_document_locator(). See the source code for XML::SAX::PurePerl for a usage example. API There is only 1 method: "new". Simply pass it a list of closures that when called will return the PublicId, the SystemId, the LineNumber, the ColumnNumber, the Encoding and the XMLVersion respectively. The closures are passed a single parameter, the key being requested. But you're free to ignore that. ATTRIBUTES See attributes(7) for descriptions of the following attributes: +---------------+----------------------------+ |ATTRIBUTE TYPE | ATTRIBUTE VALUE | +---------------+----------------------------+ |Availability | library/perl-5/xml-sax-532 | +---------------+----------------------------+ |Stability | Volatile | +---------------+----------------------------+ NOTES Source code for open source software components in Oracle Solaris can be found at https://www.oracle.com/downloads/opensource/solaris-source- code-downloads.html. This software was built from source available at https://github.com/oracle/solaris-userland. The original community source was downloaded from http://search.cpan.org/CPAN/authors/id/G/GR/GRANTM/XML-SAX-0.99.tar.gz. Further information about this software can be found on the open source community website at http://search.cpan.org/~grantm/XML- SAX-0.99/SAX.pm. perl v5.32.0 2009-10-10 SAX::DocumentLocator(3)