SVG::Parser::SAX(3pm)
π 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 π
SVGSVG::ParserSVG::Parser::ExpatXML::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
- fedora 43: perl-SVG-Parser 1.03-49.fc43 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms