Perl Diver 2.31
Main Environment Variables Perl Default Values Perl Config - Summary Perl Config - Full Installed Modules List Directory uptime Docs

Module Documentation
Details and documentation about a specific module, including version and documentation (if available). Note that while links to perldoc.com and search.cpan.org are provided, the module may be part of a larger distribution. If you reach a File Not Found page on either site, please try the parent module.

XML::SAX::DocumentLocator

Name XML::SAX::DocumentLocator
Version
Located at /usr/share/perl5/vendor_perl
File /usr/share/perl5/vendor_perl/XML/SAX/DocumentLocator.pm
Is Core No
Search CPAN for this module XML::SAX::DocumentLocator
Documentation XML::SAX::DocumentLocator
Module Details XML::SAX::DocumentLocator

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.

Perl Diver brought to you by ScriptSolutions.com © 1997- 2024