Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

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

by tangent (Parson)
on Sep 28, 2019 at 19:20 UTC ( [id://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?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (6)
As of 2024-04-23 17:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found