.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "XML::SAX2Perl 3" .TH XML::SAX2Perl 3 2024-07-12 "perl v5.38.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME XML::SAX2Perl \-\- translate Java/CORBA style SAX methods to Perl methods .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 1 \& use XML::SAX2Perl; \& \& $sax2perl = XML::SAX2Perl(Handler => $my_handler); \& $sax\->setDocumentHandler($sax2perl); .Ve .SH DESCRIPTION .IX Header "DESCRIPTION" \&\f(CW\*(C`XML::SAX2Perl\*(C'\fR 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 \&\f(CW\*(C`XML::SAX2Perl\*(C'\fR; please refer to the Perl SAX standard \f(CW\*(C`XML::SAX\*(C'\fR for general usage information. .SH METHODS .IX Header "METHODS" .IP new 4 .IX 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 `\f(CWparse()\fR' override the default options in the parser object for the duration of the parse. .IP parse 4 .IX Item "parse" Parses a document. Options, described below, are passed as key-value pairs or as a single hash. Options passed to `\f(CWparse()\fR' override default options in the parser object. .IP location 4 .IX Item "location" Returns the location as a hash: .Sp .Vb 6 \& 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. .Ve .IP "SAX DocumentHandler Methods" 4 .IX Item "SAX DocumentHandler Methods" The following methods are DocumentHandler methods that the SAX 1.0 parser will call and \f(CW\*(C`XML::SAX2Perl\*(C'\fR will translate to Perl SAX methods calls. See SAX 1.0 for details. .Sp .Vb 8 \& setDocumentLocator(locator) \& startDocument() \& endDocument() \& startElement(name, atts) \& endElement(name) \& characters(ch, start, length) \& ignorableWhitespace(ch, start, length) \& processingInstruction(target, data) .Ve .SH OPTIONS .IX Header "OPTIONS" The following options are supported by \f(CW\*(C`XML::SAX2Perl\*(C'\fR: .PP .Vb 7 \& 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 .Ve .PP If no handlers are provided then all events will be silently ignored, except for `\f(CWfatal_error()\fR' which will cause a `\f(CWdie()\fR' to be called after calling `\f(CWend_document()\fR'. .PP If a single string argument is passed to the `\f(CWparse()\fR' method, it is treated as if a `\f(CW\*(C`Source\*(C'\fR' option was given with a `\f(CW\*(C`String\*(C'\fR' parameter. .PP The `\f(CW\*(C`Source\*(C'\fR' hash may contain the following parameters: .PP .Vb 6 \& 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. .Ve .PP If more than one of `\f(CW\*(C`ByteStream\*(C'\fR', `\f(CW\*(C`String\*(C'\fR', or `\f(CW\*(C`SystemId\*(C'\fR', then preference is given first to `\f(CW\*(C`ByteStream\*(C'\fR', then `\f(CW\*(C`String\*(C'\fR', then `\f(CW\*(C`SystemId\*(C'\fR'. .SH HANDLERS .IX Header "HANDLERS" The following handlers and properties are supported by \&\f(CW\*(C`XML::SAX2Perl\*(C'\fR: .SS "DocumentHandler methods" .IX Subsection "DocumentHandler methods" .IP start_document 4 .IX Item "start_document" Receive notification of the beginning of a document. .Sp .Vb 2 \& Locator An object that can return the location of any SAX \& document event. .Ve .IP end_document 4 .IX Item "end_document" Receive notification of the end of a document. .Sp No properties defined. .IP start_element 4 .IX Item "start_element" Receive notification of the beginning of an element. .Sp .Vb 2 \& Name The element type name. \& Attributes Attributes attached to the element, if any. .Ve .Sp ALPHA WARNING: The `\f(CW\*(C`Attributes\*(C'\fR' value is not translated from the SAX 1.0 value, so it will contain an AttributeList object. .IP end_element 4 .IX Item "end_element" Receive notification of the end of an element. .Sp .Vb 1 \& Name The element type name. .Ve .IP characters 4 .IX Item "characters" Receive notification of character data. .Sp .Vb 1 \& Data The characters from the XML document. .Ve .IP ignorable_whitespace 4 .IX Item "ignorable_whitespace" Receive notification of ignorable whitespace in element content. .Sp .Vb 1 \& Data The characters from the XML document. .Ve .IP processing_instruction 4 .IX Item "processing_instruction" Receive notification of a processing instruction. .Sp .Vb 2 \& Target The processing instruction target. \& Data The processing instruction data, if any. .Ve .SH AUTHOR .IX Header "AUTHOR" Ken MacLeod .SH "SEE ALSO" .IX Header "SEE ALSO" \&\fBperl\fR\|(1), \fBXML::Perl2SAX\fR\|(3). .PP .Vb 2 \& Extensible Markup Language (XML) \& Simple API for XML (SAX) .Ve