PXR::Parser 0.1.5 review
DownloadPXR::Parser is a Pure Perl SAX XML Push Parser. SYNOPSIS use PXR::Parser; my $parser = PXR::Parser->new(
|
|
PXR::Parser is a Pure Perl SAX XML Push Parser.
SYNOPSIS
use PXR::Parser;
my $parser = PXR::Parser->new(
'Handlers' => {
'startDocument' => &start_doc,
'endDocument' => &end_doc,
'startElement' => &start_element,
'endElement' => &end_element,
'characters' => &characters,
}
);
$parser->parse($data);
$parser->setHandlers('startDocument' => &different_start);
A simple, fast, efficient pure perl sax xml parser.
BUGS AND NOTES
This Parser was blatantly ripped and modified from XML::Stream::Parser because it was the only pure perl parser simple and speedy enough to be included by default in various other things such as PXR or PoCo::Jabber. Just note that there is no recovering or detecting XML malformedness. So if you feed this little pet something non-tasty, you are in for a surprise (mainly memory leaking everywhere, and other things like gnawing on furniture).
That is the trade off for its speed. In situtations where you know you are not going to get malformed XML such as a connection to a jabber server (or other XML pushing entities) then this parser is ideal. Currently, the speed difference between this parser and XML::Parser::Expat are about 30 percent in favor of XML::Parser::Expat (which says alot of the speed of this pure perl implementation).
Thanks to Ryan Eatmon for writing and releasing this code. It has been a boon to those of us that really appreciate a simple small solution.
Requirements:
Perl
PXR::Parser 0.1.5 search tags