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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.