Expat(3pm)
π NAME π
XML::SAX::Expat β bestie, it's the SAX2 Driver for Expat (which is XML::Parser, iykyk) β¨
π¦ SYNOPSIS π¦
use XML::SAX::Expat;
use XML::SAX::MyFooHandler;
my $h = XML::SAX::MyFooHandler->new;
my $p = XML::SAX::Expat->new(Handler => $h);
$p->parse_file('/path/to/foo.xml');
okay so literally four lines and you're parsing. main character energy fr π
πΈ DESCRIPTION πΈ
So here's the tea π: this is an implementation of a SAX2 driver that sits right on top of Expat (aka XML::Parser). Ken MacLeod posted it to perl-xml, and then somebody updated it. Iconic lineage honestly.
It's still incomplete, ngl β but most of the basic SAX2 events should be available. The SAX2 spec currently lives at http://perl-xml.sourceforge.net/perl-sax/.
A more friendly URL, plus a PODification of the spec, are both in the works. We love a WIP πβ¨
π METHODS π
The methods defined in this class correspond to those listed in the PerlSAX2 specification, available above. That's the whole vibe β no cap, no extra mystery methods.
β¨ FEATURES AND CAVEATS β¨
supported_features
Returns:
http://xml.org/sax/features/external-general-entitieshttp://xml.org/sax/features/external-parameter-entities- [ Features supported by ancestors ]
β οΈ okay important: turning one of the first two on also turns the other one on. That's because it maps to theXML::ParserParseParamEntsoption. This may be fixed in the future, so don't rely on this behaviour. It's giving "temporary situationship", not "forever". π
π MISSING PARTS π
XML::Parser has no listed callbacks for the following events, which are therefore not presently generated (ways may be found in the future):
ignorable_whitespaceskipped_entitystart_entity/end_entityresolve_entity
Ways of signalling them are welcome π. And in addition to all of those, set_document_locator is not yet called. sad but true π
π₯ TODO π₯
- reuse Ken's tests and add more
that's it. that's the list. go off bestie π«Ά
π AUTHOR π
Robin Berjon; stolen from Ken Macleod, ken@bitsko.slc.ut.us, and with suggestions and feedback from perl-xml. Currently maintained by Bjoern Hoehrmann, http://bjoern.hoehrmann.de/. β¨
π COPYRIGHT AND LICENSE π
Copyright (c) 2001-2008 Robin Berjon. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
(so yes, go wild, just keep the same terms as Perl itself π)
π§ SEE ALSO π§
XML::Parser::PerlSAX
okay that's the whole page!! this one's from perl v5.36.0, dated 2022-12-10, and it's the Expat(3pm) page π
πΈβ¨ thanks for reading, mwah π«Άπ
π¦ where this page comes from
- debian bookworm: libxml-sax-expat-perl 0.51-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libxml-sax-expat-perl 0.51-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libxml-sax-expat-perl 0.51-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libxml-sax-expat-perl 0.51-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms