Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

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

by toolic (Bishop)
on Oct 06, 2014 at 15:46 UTC ( #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? | Other CB clients
Other Users?
Others pondering the Monastery: (4)
As of 2022-12-03 22:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?