Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^5: Truncating an HTML node using XPaths in HTML::TreeBuilder::XPath

by tangent (Vicar)
on Sep 28, 2019 at 19:20 UTC ( #11106822=note: print w/replies, xml ) Need Help??


in reply to Re^4: Truncating an HTML node using XPaths in HTML::TreeBuilder::XPath
in thread Truncating an HTML node using XPaths in HTML::TreeBuilder::XPath

You can test each item in content_list to see if it is a <br> tag:
for my $d ($root->findnodes($xpath)) { my @line = $d->content_list; my @truncated; for my $line (@line) { if (ref $line) { last if $line->tag eq 'br'; } push(@truncated,$line); } $d->replace_with(@truncated); }

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11106822]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (6)
As of 2022-01-21 09:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:












    Results (57 votes). Check out past polls.

    Notices?