Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: How to avoid addition of tags by HTML::TreeBuilder

by Veltro (Hermit)
on Apr 19, 2019 at 08:16 UTC ( [id://1232794]=note: print w/replies, xml ) Need Help??


in reply to How to avoid addition of tags by HTML::TreeBuilder

It seems it adds the html and head tags for convenience, you can just get the body like this:

my $body = $root->find('body'); print $body->as_HTML;

edit: Although, now it seems that the ending /p tags go missing and I am not sure why. Maybe the module is not perfect, try this as a workaround:

my @foo = $html->look_down( _tag => "body", ) ; foreach( @foo ) { my $output_html = $_->as_HTML(undef,undef,{}); print $output_html; last ; }

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (2)
As of 2024-04-26 01:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found