I'm having a issue with HTML::Treebuilder. After my data hits the XSLT transformer, I have to do some post-processing on the HTML code to finish out some project requirements. In this case I have 2 functions that use HTML::Treebuilder in series (I don't think it would be a good idea yet to combine them).

The first TreeBuilder pass works great. The second pass through the Treebuilder causes not all, but some of the ending html tags to loose the ending tags. Notably 'li' and 'p' tags.

For the second pass, I did a cut and paste of the tree setup and output/teardown code from the first pass. I have tried using the second pass just to pull in the HTML and then output it right back out without changing it, yet it drops the ending tags anyways.

I am wondering if this is a known issue with HTML::TreeBuilder? Any work arounds or other advise?

-- Brian


*** Edit ***
Sorry about this, but it appears that I had my passes mixed up. Either way, jdporter gave me the advice I needed to fix it (thanks man).

My first pass was messing up the markup by not putting in the ending tags and when the second tree got ahold of it (I gave it options to preserve the data as it gets it since it was a secion of a HTML page). It built a goofy tree whereas the other pass needed a good tree to do a page order tree walk.

Thanks for the quick turnaround on this. It would have taken forever on google groups.


In reply to HTML::TreeBuilder dropping end tags by admiral_grinder

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.