.\" Automatically generated by Pod::Man 4.14 (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 .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . 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 3pm" .TH XML::SAX2Perl 3pm "2022-12-13" "perl v5.36.0" "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 \s-1SAX\s0 filter that translates Java/CORBA style \s-1SAX\s0 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 \s-1SAX\s0 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(CW\*(C`parse()\*(C'\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(CW\*(C`parse()\*(C'\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 "\s-1SAX\s0 DocumentHandler Methods" 4 .IX Item "SAX DocumentHandler Methods" The following methods are DocumentHandler methods that the \s-1SAX 1.0\s0 parser will call and \f(CW\*(C`XML::SAX2Perl\*(C'\fR will translate to Perl \s-1SAX\s0 methods calls. See \s-1SAX 1.0\s0 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(CW\*(C`fatal_error()\*(C'\fR' which will cause a `\f(CW\*(C`die()\*(C'\fR' to be called after calling `\f(CW\*(C`end_document()\*(C'\fR'. .PP If a single string argument is passed to the `\f(CW\*(C`parse()\*(C'\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 \&\s-1ALPHA WARNING:\s0 The `\f(CW\*(C`Attributes\*(C'\fR' value is not translated from the \&\s-1SAX 1.0\s0 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