Click here to get back home

XML::Twig constructor disregarding map_xmlns - bug in module?

 HomeNewsGroups | Search | About
 comp.lang.perl.modules    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
XML::Twig constructor disregarding map_xmlns - bug in module? Andres Monroy-Hernandez 08-29-2004
Posted by Andres Monroy-Hernandez on August 29, 2004, 1:21 pm
Please log in for more thread options
Has anyone experience any problems with map_xmlns?

This handler nevers gets called. This is very similar to the example
in the documentation, but for some reason it doesn't work.

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
"matched!"; $_[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);


Any ideas? Thanks a lot!


Similar ThreadsPosted
XML Twig help April 8, 2005, 2:18 pm
Using XML::Twig December 19, 2005, 4:59 pm
XML::Twig June 9, 2006, 1:50 pm
XML::Twig June 9, 2006, 6:27 pm
XML::Twig question December 23, 2007, 2:25 pm
Help with XML::Twig xpath syntax, please October 16, 2005, 6:56 pm
XML::Twig parseurl with input Headers/XML January 16, 2005, 10:58 pm
XML::Twig::XPath - strange problem November 10, 2005, 9:44 am
XML::Twig produces double encoded UTF-8 January 4, 2007, 3:36 pm
Problem Parsing Huge XML file using XML::Twig April 23, 2007, 10:24 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap