Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: HTML::TreeBuilder::XPath returns things I don't need?

by toolic (Bishop)
on Oct 06, 2014 at 15:46 UTC ( [id://1102989]=note: print w/replies, xml ) Need Help??


in reply to HTML::TreeBuilder::XPath returns things I don't need?

XML::Twig (by the same module author) can give you what you want:
use warnings; use strict; use XML::Twig; my $xml = <<XML; <html> <title>four</title> <head> <title>one</title> </head> <body> <title>two</title> </body> <title>three</title> </html> XML my $twig = XML::Twig->new( twig_handlers => { 'html/head/title' => sub { print $_->text(), "\ +n" } }, ); $twig->parse($xml); __END__ one

Replies are listed 'Best First'.
Re^2: HTML::TreeBuilder::XPath returns things I don't need?
by szabgab (Priest) on Oct 06, 2014 at 15:59 UTC
    Thanks

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (3)
As of 2025-03-26 20:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    When you first encountered Perl, which feature amazed you the most?










    Results (68 votes). Check out past polls.

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.