SVG::Parser::SAX(3pm)

πŸ“¦
version 1.03 Β· 2 versions
, in fedora 43

πŸ’– SVG::Parser::SAX πŸ’–

okay so bestie, welcome to SVG::Parser::SAX β€” the XML SAX Parser for SVG documents ✨ (this is a page from the User Contributed Perl Documentation, in case you were wondering who wrote it down for us 🫢)


✨ SYNOPSIS ✨

#!/usr/bin/perl -w
use strict;
use SVG::Parser::SAX;

die "Usage: $0 <file>\n" unless @ARGV;

my $xml;
{
    local $/=undef;
    $xml=<>;
}

my $parser=new SVG::Parser::SAX(-debug => 1);

my $svg=$parser->parse($xml);

print $svg->xmlify;

🌸 DESCRIPTION 🌸

SVG::Parser::SAX is the SAX-based parser module that SVG::Parser reaches for whenever the underlying parser that got selected is one of those XML::SAX-based ones. no cap. but also?? you can absolutely use it directly, all by yourself, exactly like the synopsis up there is doing πŸ’…

If you want maximum flexibility about which underlying parser gets picked, use SVG::Parser. But if you wanna hand over SAX-specific parser options, or you already know for a fact there's a working XML::SAX parser hanging around (or you just prefer it that way), then SVG::Parser::SAX is your girl πŸŽ€

πŸ’œ EXPORTS πŸ’œ

None. like, literally zero. πŸ™ˆ

BUT β€” plot twist β€” you can specify which SAX parser implementation you prefer by passing the package name to SVG::Parser::SAX in the import list. it's giving choose-your-own-adventure. for example:

use SVG::Parser::SAX qw(XML::LibXML::SAX::Parser);

and a minimum version number can be tacked on as a second import item, bestie:

use SVG::Parser::SAX (XML::LibXML::SAX::Parser => 1.40);

that right there overrides the automatic selection of a suitable SAX parser. periodt. πŸ’…

Now, if your vibe is trying several different parsers in turn, then use the SVG::Parser module instead and restrict it so it only tries SAX-based parsers. And if you want the automatic selection mechanism to do its lil thing? just omit the import list. let it cook. πŸ“

When it's loaded via SVG::Parser, you can specify this parent class by placing it after the = in a parser specification:

See SVG::Parser for more details. iykyk 😌

πŸ¦‹ EXAMPLES πŸ¦‹

See "svgsaxparse" in the examples directory of the distribution. go look, it's right there, it's iconic πŸ‘‘


πŸ‘‘ AUTHOR πŸ‘‘

Peter Wainwright, peter.wainwright@cybrid.net


🌈 SEE ALSO 🌈

  • SVG
  • SVG::Parser
  • SVG::Parser::Expat
  • XML::SAX

okay that's the whole page, bestie, we ate and left no crumbs πŸ’–βœ¨ this lil number is running on perl v5.42.0, dated 2025-07-25, and it goes by the full government name SVG::Parser::SAX(3pm) πŸŽ€ mwah, go parse something gorgeous πŸ¦‹πŸ’…

πŸ“¦ where this page comes from