in reply to Re: Merging two anchors with HTML::TreeBuilder
in thread Merging two anchors with HTML::TreeBuilder
use HTML::TreeBuilder::XPath; #~ my $root = HTML::TreeBuilder->new; my $root = HTML::TreeBuilder::XPath->new; for my $secondlink ( $root->findnodes( '//td/a[2]' ) ){ my $td = $secondlink->parent; my $newtext = $td->as_trimmed_text ; $secondlink->delete_content; $secondlink->push_content( $newtext ) ; $secondlink->detach; $td->delete_content; $td->push_content( $secondlink ); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Merging two anchors with HTML::TreeBuilder
by mldvx4 (Hermit) on May 10, 2016 at 19:29 UTC |