I've created a minimal test program and test XML document that illustrates the problems we're having:
Here's the test XML document (named "test.xml"):#!/usr/bin/perl -w # twigtest.pl use strict; use XML::Twig; my $t = new XML::Twig( TwigHandlers => { 'download' => \&tag_download, '_default_' => \&tag__default, } ); if (!($t->safe_parsefile('test.xml'))) { warn("Error: Test XML had processing errors: $@\n"); } # Handles the <download> tag. sub tag_download { my ($t,$elt) = @_; print("Found a <download>!\n"); $t->purge(); } # Handles any unrecognized tag. sub tag__default { my ($t,$elt) = @_; print("Unrecognized tag: <".$elt->gi().">!\n"); $t->purge(); }
The output from running "./twigtest.pl" is:<?xml version="1.0" ?> <download> <oops/> </download>
which seems to indicate that tag__default isn't being called by XML::Twig.Found a <download>!
The version of Perl we're using is 5.005_03, haven't yet had a chance to try it on 5.6.1. XML::Twig version is 2.02. Am I doing something wrong? Has anybody else experienced this problem?
- Zoogie
In reply to Problems with default twig handler in XML::Twig by Zoogie
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |