http://qs1969.pair.com?node_id=499993


in reply to Re: Parsing HTML and Inserting JavaScript/HTML into Documents
in thread Parsing HTML and Inserting JavaScript/HTML into Documents

Thanks, fizbin, for your reply.

My intentions are not malicious here. There are no designs to hijack the browser or web experience. Although, now I see, after considering your response, that there would be security issues with this type of application.

Here is the code snippet from one of my “experiments” in parsing with the HTML::TreeBuilder module.
#!perl -w use HTML::TreeBuilder; use diagnostics; use strict; my $root = HTML::TreeBuilder->new; $root->parse_file('sample_document.htm') || die $!; my @paras = $root->find_by_tag_name('p'); foreach my $h (@paras) { foreach my $item_r ($h->content_refs_list) { next if ref $$item_r; ### proprietary JavaScript/HMTL inserted with substitution } } # end foreach print $root->as_HTML;