Glimpsing through the source, it doesn't look as if it'd be too hard to patch it so that ignore_unknown could be a coderef instead of a boolean value. Then you could set it to a predicate which looks at the tag name and returns whether or not to ignore it.
## ... circa line 152 of HTML/TreeBuilder.pm $self->{'_ignore_unknown'} = sub { 1 }; ## ... circa line 660 in HTML/TreeBuilder.pm if( $self->{ '_ignore_unknown' }->( $tag ) ) { print $indent, " * Ignoring unknown tag \U$tag\E\n" if DEBUG $self->warning("Skipping unknown tag $tag"); return } ## ... later in your code $tree->ignore_unknown( sub { return 1 if $_[0] !~ /^mig:/ } );
As is you'd have to make your own copy and/or edit the installed version instead of overriding in a subclass. But still, easily do-able (and if you get it working right submit a patch :).
In reply to Re^3: Custom XML tags in HTML::TreeBuilder and HTML::Element
by Fletch
in thread Custom XML tags in HTML::TreeBuilder and HTML::Element
by slaniel
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |