Expat(3pm)

πŸ“¦
version 0.51 Β· 5 versions
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute

πŸ’– 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:

⚠️ okay important: turning one of the first two on also turns the other one on. That's because it maps to the XML::Parser ParseParamEnts option. 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_whitespace
  • skipped_entity
  • start_entity / end_entity
  • resolve_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 πŸ”₯

  1. 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 (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