bbfu,

Thank you for your reply.

I perused your code, not running it. I trust it works. In fact, at one point I'd thought I'd have to do it "your" way.

Let me backtrack and get certain facts straight. From my reading of the documentation I understand there are two ways of controlling how the printed output of a document tree will look.

(a) The $entities parameter passed to the as_HTML method.
(b) Using the '~literal' pseudo-element.

Am I right or missing something ?

Let me keep on ruminating. In my situation, I've dozens of HTML files whose contents I know nothing about, and should not have to care to know about. By contents I mean text the user can see rendered in the browser—not markup.

My program reflects the following process:

(a) read an HTML input file;
(b) construct a document tree;
(c) repair text nodes, traversing the tree;
(d) print the tree as an HTML file.

Suppose my input HTML file contains the following string:

— ©

When my program goes through steps (a), (b) and (d), omitting the step (c), the string in the output file is DIFFERENT from that in the input file.

Before I go any further in this conversation, let me pause here and ask this question:

Do you know how to get from the document tree exactly the same text as “went into” the tree ?

Thank you for your time.

Cheers

P.S.

I'm using ActiveState's Perl 5.6.1 on Win2K.


In reply to Re: Re: processing text nodes using HTML::Element by Anonymous Monk
in thread processing text nodes using HTML::Element by Anonymous Monk

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.