Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Extracting ALT text from image links

by Matts (Deacon)
on Jun 25, 2002 at 15:13 UTC ( [id://177104]=note: print w/replies, xml ) Need Help??


in reply to Extracting ALT text from image links

Ooh, lots of different solutions. Here's one using XML::LibXML:

#!/usr/bin/perl -w use strict; use XML::LibXML; my $file = $ARGV[0] || die "Usage: $0 [uri|filename]\n"; my $doc = XML::LibXML->new->parse_html_file($file); print "Alt tags in $file:\n"; foreach my $alt ($doc->findnodes('//img/@alt')) { print "Alt tag: ", $alt->nodeValue, "\n"; } print "Done\n";

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://177104]
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: (3)
As of 2024-04-19 22:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found