NAME
URL::Transform::SAX::Filter - SAX filter to execute url transformation function when an attribute with url is found
SYNOPSIS
my $writer = XML::SAX::Writer->new( Output => sub {
my $type = shift;
$output_function->(@_);
} );
my $filter = URL::Transform::SAX::Filter->new(
Handler => $writer,
transform_function => sub { return join('|', @_) },
);
my $sax_parser = XML::SAX::ParserFactory->parser(
'Handler' => $filter,
);
$sax_parser->parse_file('test.html');
DESCRIPTION
This filter examines every start tag for a presence of tags and their attributes which may hold link attributes. (SEE HTML::Tagset::linkElements)
For each of them the 'transform_function' is triggered which can modify the url. This function receives following arguments:
$self->{'transform_function'}->(
'tag_name' => 'img',
'attribute_name' => 'src',
'url' => 'http://search.cpan.org/s/img/cpan_banner.png',
);
METHODS
new()
Object constructor.
Requires the 'transform_function' as the argument.
start_element()
This function handles the 'transform_function' triggering with a proper arguments.
xml_decl
Just ignoring xml declaration. Otherwise we'll end-up with <?xml version="1.0"?>
added to all documents.
SEE ALSO
URL::Transform, URL::Transform::using::XML::SAX, XML::SAX::Base
AUTHOR
Jozef Kutej