amonroy has asked for the wisdom of the Perl Monks concerning the following question:
I am re-posting because my original question was updated too many times so it might have been a little confusing. My apologies.
The problem I have is that XML::Twig seems to disregard the map_xmlns argument. Could someone tell me what's wrong with my code? The warn "matched!" never get's called.
use XML::Twig; use strict; my $twig = XML::Twig->new( map_xmlns => { "http://perlmonks.org" => 'aaa', "http://perlmonks.org/blah"=> 'bbb' }, TwigHandlers => { '/aaa:monastery/aaa:foo/bbb:bar/bbb:monk' => sub { warn "match +ed!"; $_[0]->purge; } } ); my $xml =<<XML; <?xml version="1.0" encoding="UTF-8"?> <prefix:monastery xmlns:prefix="http://perlmonks.org"> <prefix:foo> <prefix2:bar xmlns:prefix2="http://perlmonks.org/blah"> <prefix2:monk>Larry Wall</prefix2:monk> </prefix2:bar> </prefix:foo> </prefix:monastery> XML $twig->parse($xml);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: XML::Twig disregarding map_xmlns in the constructor
by PodMaster (Abbot) on Aug 30, 2004 at 04:52 UTC |