1XML::SAX::DocumentLocatUosre(r3)Contributed Perl DocumenXtMaLt:i:oSnAX::DocumentLocator(3)
2
3
4
6 XML::SAX::DocumentLocator - Helper class for document locators
7
9 my $locator = XML::SAX::DocumentLocator->new(
10 sub { $object->get_public_id },
11 sub { $object->get_system_id },
12 sub { $reader->current_line },
13 sub { $reader->current_column },
14 sub { $reader->get_encoding },
15 sub { $reader->get_xml_version },
16 );
17
19 This module gives you a tied hash reference that calls the specified
20 closures when asked for PublicId, SystemId, LineNumber and
21 ColumnNumber.
22
23 It is useful for writing SAX Parsers so that you don't have to
24 constantly update the line numbers in a hash reference on the object
25 you pass to set_document_locator(). See the source code for
26 XML::SAX::PurePerl for a usage example.
27
29 There is only 1 method: "new". Simply pass it a list of closures that
30 when called will return the PublicId, the SystemId, the LineNumber, the
31 ColumnNumber, the Encoding and the XMLVersion respectively.
32
33 The closures are passed a single parameter, the key being requested.
34 But you're free to ignore that.
35
36
37
38perl v5.34.0 2022-01-21 XML::SAX::DocumentLocator(3)