XML::S...chines(3pm)
β¨ NAME β¨
XML::SAX::Machines β manage collections of SAX processors π
(also hi bestie, this is a User Contributed Perl Documentation page, and the module we're hyping up today is XML::S...chines(3pm) π)
πΈ VERSION πΈ
version 0.46 β¨
π SYNOPSIS π
okay so here's the vibe:
use XML::SAX::Machines qw( :all );
my $m = Pipeline(
"My::Filter1", ## My::Filter1 autoloaded in Pipeline()
"My::Filter2", ## My::Filter2 " " "
\*STDOUT, ## XML::SAX::Writer also loaded
);
$m->parse_uri( $uri ); ## A parser is autoloaded via
## XML::SAX::ParserFactory if
## My::Filter1 isn't a parser.
## To import only individual machines:
use XML::SAX::Machines qw( Manifold );
## Here's a multi-pass machine that reads one document, runs
## it through 5 filtering channels (one channel at a time) and
## reassembles it in to a single document.
my $m = Manifold(
"My::TableOfContentsExtractor",
"My::AbstractExtractor",
"My::BodyFitler",
"My::EndNotesFilter",
"My::IndexFilter",
);
$m->parse_string( $doc );
like, look at that. she's organized, she's efficient, she's that girl π«Ά
π¦ DESCRIPTION π¦
SAX machines are a way to gather and manage SAX processors without going nuts. Or at least without going completely nuts. π
ngl individual machines can also be like SAX processors β they don't even have to parse or write anything:
my $w = XML::SAX::Writer->new( Output => \*STDOUT );
my $m = Pipeline( "My::Filter1", "My::Filter2", { Handler => $w } );
my $p = XML::SAX::ParserFactory->new( handler => $p );
(yes bestie, that last line uses $p before it exists. the manpage said it. we don't ask questions. we respect the lore π)
More documentation to come; for now go read XML::SAX::Pipeline, XML::SAX::Manifold, and XML::SAX::Machine.
Here are the machines this module knows about:
ByRecord Record oriented processing of documents.
L<XML::SAX::ByRecord>
Machine Generic "directed graph of SAX processors" machines.
L<XML::SAX::Machine>
Manifold Multipass document processing
L<XML::SAX::Manifold>
Pipeline A linear sequence of SAX processors
L<XML::SAX::Pipeline>
Tap An insertable pass through that examines the
events without altering them using SAX processors.
L<XML::SAX::Tap>
π Config file π
As mentioned in "LIMITATIONS", you might occasionally need to edit the config file to tell XML::SAX::Machine how to handle a particular SAX processor (SAX processors use a wide variety of API conventions, bestie, it's giving chaos π).
The config file is a the Perl module XML::SAX::Machines::SiteConfig, which contains a Perl data structure like:
package XML::SAX::Machines::SiteConfig;
$ProcessorClassOptions = {
"XML::Filter::Tee" => {
ConstructWithHashedOptions => 1,
},
};
So far $Processors is the only available configuration structure. It contains a list of SAX processors with known special needs. π
Also, so far the only special need is the ConstructWithHashes option which tells XML::SAX::Machine to construct such classes like:
XML::Filter::Tee->new(
{ Handler => $h }
);
instead of
XML::Filter::Tee->new( Handler => $h );
β οΈ WARNING β οΈ If you modify anything, apply your changes in a new file created fromXML::SAX::Machines::SiteConfig.pm. On Debian systems, this should be placed in/etc/perlso that it is not overwritten during upgrade. Do not alterXML::SAX::Machines::ConfigDefaults.pmor you will lose your changes when you upgrade. π like literally do not.
TODO: Allow per-app and per-machine overrides of options. When needed. (not today bestie β¨)
π NAME π
XML::SAX::Machines - manage collections of SAX processors
π AUTHORS π
Barrie Slaymaker
π LICENCE π
Copyright 2002-2009 by Barrie Slaymaker.
This software is free. It is licensed under the same terms as Perl itself.
β AUTHORS β
- Barry Slaymaker
- Chris Prather <chris@prather.org>
π₯ COPYRIGHT AND LICENSE π₯
This software is copyright (c) 2013 by Barry Slaymaker.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
okay that's the whole page bestie, mwah π
this iconic lil manual came to you via perl v5.34.0, dated 2022-06-28, and it's the XML::S...chines(3pm) page β slay, no cap, go build some machines π¦β¨π
π¦ where this page comes from
- debian bookworm: libxml-sax-machines-perl 0.46-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libxml-sax-machines-perl 0.46-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libxml-sax-machines-perl 0.46-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libxml-sax-machines-perl 0.46-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libxml-sax-machines-perl 0.46-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