XML::Filter::Dispatcher 0.52 review
DownloadXML::Filter::Dispatcher is a path based event dispatching with DOM support. SYNOPSIS use XML::Filter::Dispatcher qw( :all )
|
|
XML::Filter::Dispatcher is a path based event dispatching with DOM support.
SYNOPSIS
use XML::Filter::Dispatcher qw( :all );
my $f = XML::Filter::Dispatcher->new(
Rules => [
'foo' => &handle_foo_start_tag,
'@bar' => &handle_bar_attr,
## Send any elts and their contents to $handler
'snarf//self::node()' => $handler,
## Print the text of all elements
'description'
=> [ 'string()' => sub { push @out, xvalue } ],
],
Vars => {
"id" => [ string => "12a" ],
},
);
WARNING: Beta code alert.
A SAX2 filter that dispatches SAX events based on "EventPath" patterns as the SAX events arrive. The SAX events are not buffered or converted to an in-memory document representation like a DOM tree. This provides for low lag operation because the actions associated with each pattern are executed as soon as possible, usually in an element's start_element() event method.
This differs from traditional XML pattern matching tools like XPath and XSLT (which is XPath-based) which require the entire document to be built in memory (as a "DOM tree") before queries can be executed. In SAX terms, this means that they have to build a DOM tree from SAX events and delay pattern matching until the end_document() event method is called.
Requirements:
Perl
XML::Filter::Dispatcher 0.52 keywords