in reply to Re: How to obtain text in Mojo::DOM ?
in thread How to obtain text in Mojo::DOM ?
Thank you ! May I ask another question ? How to directly locate deliveryCount,get text content WORK? Is it not need to use loop method,such as for,to lookup spanid?use Mojo::DOM; $|=1; my $text='<span class="f-f60 fb">one</span>two</li> <li>three<span class="f-f60 fb" id="deliveryCount">WORK</span>five</li +> <li>ABC<span class="f-f60 fb" id="contactCount">XYZ</span> '; my $dom = Mojo::DOM->new($text); for my $e ($dom->find('span[id]')->each) { my $id=$e->{id}; if($id eq 'deliveryCount'){ print $id, ':', $e->text, "\n"; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: How to obtain text in Mojo::DOM ?
by Anonymous Monk on May 22, 2016 at 12:10 UTC |