XML::SAX2Perl(3)
π NAME π
XML::SAX2Perl β translate Java/CORBA style SAX methods to Perl methods. Hi bestie, welcome to the XML::SAX2Perl(3) manual page from the User Contributed Perl Documentation. This is the module that does that Java/CORBA-to-Perl SAX translation glow-up. π¦
πΈ SYNOPSIS πΈ
Lowkey the whole setup is this:
use XML::SAX2Perl;
$sax2perl = XML::SAX2Perl(Handler => $my_handler);
$sax->setDocumentHandler($sax2perl);
That's it. That's the vibe check. β¨
β¨ DESCRIPTION β¨
XML::SAX2Perl is a SAX filter that translates Java/CORBA style SAX methods to Perl style method calls. It's giving bridge era, honestly. This man page summarizes the specific options, handlers, and properties supported by XML::SAX2Perl; please refer to the Perl SAX standard XML::SAX for general usage information. π«Ά
π METHODS π
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 parse() override the default options in the parser object for the duration of the parse. π
parse
Parses a document. Options, described below, are passed as key-value pairs or as a single hash. Options passed to parse() override default options in the parser object. Override era, no cap.
location
Returns the location as a hash:
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.
SAX DocumentHandler Methods
The following methods are DocumentHandler methods that the SAX 1.0 parser will call and XML::SAX2Perl will translate to Perl SAX methods calls. See SAX 1.0 for details. π§
setDocumentLocator(locator)
startDocument()
endDocument()
startElement(name, atts)
endElement(name)
characters(ch, start, length)
ignorableWhitespace(ch, start, length)
processingInstruction(target, data)
π₯ OPTIONS π₯
The following options are supported by XML::SAX2Perl:
Handlerβ default handler to receive eventsDocumentHandlerβ handler to receive document eventsDTDHandlerβ handler to receive DTD eventsErrorHandlerβ handler to receive error eventsEntityResolverβ handler to resolve entitiesLocaleβ locale to provide localisation for errorsSourceβ hash containing the input source for parsing
If no handlers are provided then all events will be silently ignored, except for fatal_error() which will cause a die() to be called after calling end_document(). That's the dramatic exception, bestie.
If a single string argument is passed to the parse() method, it is treated as if a "Source" option was given with a "String" parameter. String-to-Source pipeline, iykyk.
The "Source" hash may contain the following parameters:
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.
If more than one of "ByteStream", "String", or "SystemId", then preference is given first to "ByteStream", then "String", then "SystemId". Priority order: ByteStream, String, SystemId. Periodt.
π HANDLERS π
The following handlers and properties are supported by XML::SAX2Perl:
DocumentHandler methods
start_document
Receive notification of the beginning of a document.
Locatorβ an object that can return the location of any SAX document event.
end_document
Receive notification of the end of a document.
No properties defined.
start_element
Receive notification of the beginning of an element.
Nameβ the element type name.Attributesβ attributes attached to the element, if any.
ALPHA WARNING: The "Attributes" value is not translated from the SAX 1.0 value, so it will contain an AttributeList object. Read that again, bestie β it's not translated.
end_element
Receive notification of the end of an element.
Nameβ the element type name.
characters
Receive notification of character data.
Dataβ the characters from the XML document.
ignorable_whitespace
Receive notification of ignorable whitespace in element content.
Dataβ the characters from the XML document.
processing_instruction
Receive notification of a processing instruction.
Targetβ the processing instruction target.Dataβ the processing instruction data, if any.
π AUTHOR π
Ken MacLeod <ken@bitsko.slc.ut.us> iconic. π
π¦ SEE ALSO π¦
And the reference links from the page:
- Extensible Markup Language (XML) β
<http://www.w3c.org/XML/> - Simple API for XML (SAX) β
<http://www.megginson.com/SAX/>
that's the page, bestie π
β¨ This is the XML::SAX2Perl(3) manual, from perl v5.42.0, dated 2024-03-04. Slay, bye! π«Άπ
π¦ where this page comes from
- opensuse-leap 16.0: perl-libxml-perl 0.08-160000.2.2 Β· Artistic-1.0 OR GPL-2.0-or-later
- opensuse-leap 16.0: perl-libxml-perl 0.08-160000.2.2 Β· Artistic-1.0 OR GPL-2.0-or-later
- opensuse-leap 16.0: perl-libxml-perl 0.08-160000.2.2 Β· Artistic-1.0 OR GPL-2.0-or-later
- opensuse-leap 16.0: perl-libxml-perl 0.08-160000.2.2 Β· Artistic-1.0 OR GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms